From 891b9175769cb0ded3164841393ff599581f332f Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 13 Jul 2022 18:35:41 +0200 Subject: Simplify `on_paste` signature ... and fix spacing. --- native/src/widget/text_input.rs | 13 ++++++++----- pure/src/widget/text_input.rs | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index c131cc77..9fc09b5d 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -114,14 +114,17 @@ where self.is_secure = true; self } - /// Set's the message that should be produced when a message is pasted into the [`TextInput`]. - pub fn on_paste(mut self, on_paste: OnPaste) -> Self - where - OnPaste: 'a + Fn(String) -> Message, - { + + /// Sets the message that should be produced when some text is pasted into + /// the [`TextInput`]. + pub fn on_paste( + mut self, + on_paste: impl Fn(String) -> Message + 'a, + ) -> Self { self.on_paste = Some(Box::new(on_paste)); self } + /// Sets the [`Font`] of the [`TextInput`]. /// /// [`Font`]: crate::text::Renderer::Font diff --git a/pure/src/widget/text_input.rs b/pure/src/widget/text_input.rs index 88726a52..34edef28 100644 --- a/pure/src/widget/text_input.rs +++ b/pure/src/widget/text_input.rs @@ -87,14 +87,17 @@ where self.is_secure = true; self } - /// Set's the message that should be produced when a message is pasted into the [`TextInput`]. - pub fn on_paste(mut self, on_paste: OnPaste) -> Self - where - OnPaste: 'a + Fn(String) -> Message, - { + + /// Sets the message that should be produced when some text is pasted into + /// the [`TextInput`]. + pub fn on_paste( + mut self, + on_paste: impl Fn(String) -> Message + 'a, + ) -> Self { self.on_paste = Some(Box::new(on_paste)); self } + /// Sets the [`Font`] of the [`TextInput`]. /// /// [`Font`]: text::Renderer::Font -- cgit