diff options
author | 2022-08-17 15:54:31 +0200 | |
---|---|---|
committer | 2022-08-17 15:54:31 +0200 | |
commit | 23229e00f608585bf2d623709a4240296721777d (patch) | |
tree | df779ca4b46105fc8db6395d2480f07f83a9114a | |
parent | f21d1209aa576a3e597c100fa56afe554dc2babd (diff) | |
download | iced-23229e00f608585bf2d623709a4240296721777d.tar.gz iced-23229e00f608585bf2d623709a4240296721777d.tar.bz2 iced-23229e00f608585bf2d623709a4240296721777d.zip |
Use `FnOnce` in `Command::perform`
... and revert `FnMut` usage.
-rw-r--r-- | futures/src/command.rs | 2 | ||||
-rw-r--r-- | native/src/clipboard.rs | 4 | ||||
-rw-r--r-- | native/src/command.rs | 2 | ||||
-rw-r--r-- | native/src/command/action.rs | 2 | ||||
-rw-r--r-- | native/src/system/action.rs | 6 | ||||
-rw-r--r-- | native/src/widget/action.rs | 6 |
6 files changed, 11 insertions, 11 deletions
diff --git a/futures/src/command.rs b/futures/src/command.rs index 0b931125..05c3a1d0 100644 --- a/futures/src/command.rs +++ b/futures/src/command.rs @@ -41,7 +41,7 @@ impl<T> Command<T> { } /// Applies a transformation to the result of a [`Command`]. - pub fn map<A>(self, mut f: impl FnMut(T) -> A) -> Command<A> + pub fn map<A>(self, f: impl Fn(T) -> A) -> Command<A> where T: 'static, { diff --git a/native/src/clipboard.rs b/native/src/clipboard.rs index 6a77334c..c9105bc0 100644 --- a/native/src/clipboard.rs +++ b/native/src/clipboard.rs @@ -30,7 +30,7 @@ impl Clipboard for Null { /// [`Command`]: crate::Command pub enum Action<T> { /// Read the clipboard and produce `T` with the result. - Read(Box<dyn FnOnce(Option<String>) -> T>), + Read(Box<dyn Fn(Option<String>) -> T>), /// Write the given contents to the clipboard. Write(String), @@ -40,7 +40,7 @@ impl<T> Action<T> { /// Maps the output of a clipboard [`Action`] using the provided closure. pub fn map<A>( self, - f: impl FnOnce(T) -> A + 'static + MaybeSend + Sync, + f: impl Fn(T) -> A + 'static + MaybeSend + Sync, ) -> Action<A> where T: 'static, diff --git a/native/src/command.rs b/native/src/command.rs index 3571efc4..89ee7375 100644 --- a/native/src/command.rs +++ b/native/src/command.rs @@ -56,7 +56,7 @@ impl<T> Command<T> { /// Applies a transformation to the result of a [`Command`]. pub fn map<A>( self, - f: impl FnMut(T) -> A + 'static + MaybeSend + Sync + Clone, + f: impl Fn(T) -> A + 'static + MaybeSend + Sync + Clone, ) -> Command<A> where T: 'static, diff --git a/native/src/command/action.rs b/native/src/command/action.rs index 549632dd..3fb02899 100644 --- a/native/src/command/action.rs +++ b/native/src/command/action.rs @@ -35,7 +35,7 @@ impl<T> Action<T> { /// [`Command`]: crate::Command pub fn map<A>( self, - f: impl FnMut(T) -> A + 'static + MaybeSend + Sync, + f: impl Fn(T) -> A + 'static + MaybeSend + Sync, ) -> Action<A> where A: 'static, diff --git a/native/src/system/action.rs b/native/src/system/action.rs index 7f66141b..dea9536f 100644 --- a/native/src/system/action.rs +++ b/native/src/system/action.rs @@ -9,15 +9,15 @@ pub enum Action<T> { QueryInformation(Box<dyn Closure<T>>), } -pub trait Closure<T>: FnOnce(system::Information) -> T + MaybeSend {} +pub trait Closure<T>: Fn(system::Information) -> T + MaybeSend {} -impl<T, O> Closure<O> for T where T: FnOnce(system::Information) -> O + MaybeSend {} +impl<T, O> Closure<O> for T where T: Fn(system::Information) -> O + MaybeSend {} impl<T> Action<T> { /// Maps the output of a system [`Action`] using the provided closure. pub fn map<A>( self, - f: impl FnOnce(T) -> A + 'static + MaybeSend + Sync, + f: impl Fn(T) -> A + 'static + MaybeSend + Sync, ) -> Action<A> where T: 'static, diff --git a/native/src/widget/action.rs b/native/src/widget/action.rs index ea1d9b12..766e902b 100644 --- a/native/src/widget/action.rs +++ b/native/src/widget/action.rs @@ -16,7 +16,7 @@ impl<T> Action<T> { /// Maps the output of an [`Action`] using the given function. pub fn map<A>( self, - f: impl FnMut(T) -> A + 'static + MaybeSend + Sync, + f: impl Fn(T) -> A + 'static + MaybeSend + Sync, ) -> Action<A> where T: 'static, @@ -37,7 +37,7 @@ impl<T> Action<T> { #[allow(missing_debug_implementations)] struct Map<A, B> { operation: Box<dyn Operation<A>>, - f: Box<dyn FnMut(A) -> B>, + f: Box<dyn Fn(A) -> B>, } impl<A, B> Operation<B> for Map<A, B> @@ -52,7 +52,7 @@ where ) { struct MapRef<'a, A, B> { operation: &'a mut dyn Operation<A>, - f: &'a mut dyn FnMut(A) -> B, + f: &'a dyn Fn(A) -> B, } impl<'a, A, B> Operation<B> for MapRef<'a, A, B> { |