diff --git a/core/src/widget/operation.rs b/core/src/widget/operation.rs index 741e1a5f2f..4ee4b4a714 100644 --- a/core/src/widget/operation.rs +++ b/core/src/widget/operation.rs @@ -295,7 +295,7 @@ where /// Chains the output of an [`Operation`] with the provided function to /// build a new [`Operation`]. -pub fn chain( +pub fn then( operation: impl Operation + 'static, f: fn(A) -> O, ) -> impl Operation @@ -361,7 +361,7 @@ where Outcome::Chain(Box::new((self.next)(value))) } Outcome::Chain(operation) => { - Outcome::Chain(Box::new(chain(operation, self.next))) + Outcome::Chain(Box::new(then(operation, self.next))) } } } diff --git a/core/src/widget/operation/focusable.rs b/core/src/widget/operation/focusable.rs index 0a6f2e9658..867c682e52 100644 --- a/core/src/widget/operation/focusable.rs +++ b/core/src/widget/operation/focusable.rs @@ -94,7 +94,10 @@ pub fn count() -> impl Operation { /// Produces an [`Operation`] that searches for the current focused widget, and /// - if found, focuses the previous focusable widget. /// - if not found, focuses the last focusable widget. -pub fn focus_previous() -> impl Operation { +pub fn focus_previous() -> impl Operation +where + T: Send + 'static, +{ struct FocusPrevious { count: Count, current: usize, @@ -128,13 +131,16 @@ pub fn focus_previous() -> impl Operation { } } - operation::chain(count(), |count| FocusPrevious { count, current: 0 }) + operation::then(count(), |count| FocusPrevious { count, current: 0 }) } /// Produces an [`Operation`] that searches for the current focused widget, and /// - if found, focuses the next focusable widget. /// - if not found, focuses the first focusable widget. -pub fn focus_next() -> impl Operation { +pub fn focus_next() -> impl Operation +where + T: Send + 'static, +{ struct FocusNext { count: Count, current: usize, @@ -162,7 +168,7 @@ pub fn focus_next() -> impl Operation { } } - operation::chain(count(), |count| FocusNext { count, current: 0 }) + operation::then(count(), |count| FocusNext { count, current: 0 }) } /// Produces an [`Operation`] that searches for the current focused widget