Skip to content

Commit

Permalink
formatting by cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
JL710 committed Apr 17, 2024
1 parent fea0fba commit 26a1a9a
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions widget/src/text_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,18 @@ where
self
}

/// Sets the message that should be produced when some text is typed into
/// Sets the message that should be produced when some text is typed into
/// the [`TextInput`], if `Some`.
///
/// If `None`, the [`TextInput`] will be disabled.
pub fn on_input_maybe<F>(mut self, callback: Option<F>) -> Self
pub fn on_input_maybe<F>(mut self, callback: Option<F>) -> Self
where
F: 'a + Fn(String) -> Message,
{
self.on_input = match callback {
Some(c) => Some(Box::new(c)),
None => None
};
self.on_input = match callback {
Some(c) => Some(Box::new(c)),
None => None,
};
self
}

Expand All @@ -155,10 +155,10 @@ where
self
}

/// Sets the message that should be produced when the [`TextInput`] is
/// Sets the message that should be produced when the [`TextInput`] is
/// focused and the enter key is pressed, if `Some`.
///
/// If `None` the [`TextInput`] nothing will happen.
///
/// If `None` the [`TextInput`] nothing will happen.
pub fn on_submit_maybe(mut self, on_submit: Option<Message>) -> Self {
self.on_submit = on_submit;
self
Expand All @@ -173,19 +173,19 @@ where
self.on_paste = Some(Box::new(on_paste));
self
}
/// Sets the message that should be produced when some text is pasted into

/// Sets the message that should be produced when some text is pasted into
/// the [`TextInput`], if `Some`.
///
/// If `None` nothing will happen.
///
/// If `None` nothing will happen.
pub fn on_paste_maybe(
mut self,
on_paste: Option<impl Fn(String) -> Message + 'a>,
) -> Self {
self.on_paste = match on_paste {
Some(func) => Some(Box::new(func)),
None => None
};
self.on_paste = match on_paste {
Some(func) => Some(Box::new(func)),
None => None,
};
self
}

Expand Down

0 comments on commit 26a1a9a

Please sign in to comment.