summaryrefslogtreecommitdiffstats
path: root/native/src/system/action.rs
diff options
context:
space:
mode:
Diffstat (limited to 'native/src/system/action.rs')
-rw-r--r--native/src/system/action.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/native/src/system/action.rs b/native/src/system/action.rs
index 6dab20a6..dea9536f 100644
--- a/native/src/system/action.rs
+++ b/native/src/system/action.rs
@@ -1,15 +1,18 @@
use crate::system;
use iced_futures::MaybeSend;
-
use std::fmt;
/// An operation to be performed on the system.
pub enum Action<T> {
/// Query system information and produce `T` with the result.
- QueryInformation(Box<dyn Fn(system::Information) -> T>),
+ QueryInformation(Box<dyn Closure<T>>),
}
+pub trait Closure<T>: Fn(system::Information) -> T + 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>(