Skip to content

Commit a481853

Browse files
committed
Reduced the lifetime from 'static to 'a for the on_change function passed to NumberInput.
1 parent 2e8c3b9 commit a481853

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

src/widget/helpers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ where
296296
Message: Clone + 'a,
297297
Renderer: iced_core::text::Renderer<Font = iced_core::Font>,
298298
Theme: crate::style::number_input::ExtendedCatalog,
299-
F: 'static + Fn(T) -> Message + Copy,
300-
T: 'static
299+
F: 'a + Fn(T) -> Message + Copy,
300+
T: 'a
301301
+ num_traits::Num
302302
+ num_traits::NumAssignOps
303303
+ PartialOrd

src/widget/number_input.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ where
120120
/// - a function that produces a message when the [`NumberInput`] changes
121121
pub fn new<F>(value: &T, bounds: impl RangeBounds<T>, on_change: F) -> Self
122122
where
123-
F: 'static + Fn(T) -> Message + Clone,
124-
T: 'static,
123+
F: 'a + Fn(T) -> Message + Clone
125124
{
126125
let padding = DEFAULT_PADDING;
127126

0 commit comments

Comments
 (0)