Simplify on_paste signature

... and fix spacing.
This commit is contained in:
Héctor Ramón Jiménez 2022-07-13 18:35:41 +02:00
parent e8cfa644e7
commit 891b917576
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
2 changed files with 16 additions and 10 deletions

View file

@ -114,14 +114,17 @@ where
self.is_secure = true; self.is_secure = true;
self self
} }
/// Set's the message that should be produced when a message is pasted into the [`TextInput`].
pub fn on_paste<OnPaste>(mut self, on_paste: OnPaste) -> Self /// Sets the message that should be produced when some text is pasted into
where /// the [`TextInput`].
OnPaste: 'a + Fn(String) -> Message, pub fn on_paste(
{ mut self,
on_paste: impl Fn(String) -> Message + 'a,
) -> Self {
self.on_paste = Some(Box::new(on_paste)); self.on_paste = Some(Box::new(on_paste));
self self
} }
/// Sets the [`Font`] of the [`TextInput`]. /// Sets the [`Font`] of the [`TextInput`].
/// ///
/// [`Font`]: crate::text::Renderer::Font /// [`Font`]: crate::text::Renderer::Font

View file

@ -87,14 +87,17 @@ where
self.is_secure = true; self.is_secure = true;
self self
} }
/// Set's the message that should be produced when a message is pasted into the [`TextInput`].
pub fn on_paste<OnPaste>(mut self, on_paste: OnPaste) -> Self /// Sets the message that should be produced when some text is pasted into
where /// the [`TextInput`].
OnPaste: 'a + Fn(String) -> Message, pub fn on_paste(
{ mut self,
on_paste: impl Fn(String) -> Message + 'a,
) -> Self {
self.on_paste = Some(Box::new(on_paste)); self.on_paste = Some(Box::new(on_paste));
self self
} }
/// Sets the [`Font`] of the [`TextInput`]. /// Sets the [`Font`] of the [`TextInput`].
/// ///
/// [`Font`]: text::Renderer::Font /// [`Font`]: text::Renderer::Font