Use FnOnce in Command::perform

... and revert `FnMut` usage.
This commit is contained in:
Héctor Ramón Jiménez 2022-08-17 15:54:31 +02:00
parent f21d1209aa
commit 23229e00f6
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
6 changed files with 11 additions and 11 deletions

View file

@ -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,