From f1ec0af5070fe2752967cdc38ed66b8b70882366 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 4 May 2022 14:25:04 +0200 Subject: Run `system::information` in a different thread ... since it seems it can block for a couple of seconds. --- native/src/system/action.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'native/src') 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 { /// Query system information and produce `T` with the result. - QueryInformation(Box T>), + QueryInformation(Box>), } +pub trait Closure: Fn(system::Information) -> T + MaybeSend {} + +impl Closure for T where T: Fn(system::Information) -> O + MaybeSend {} + impl Action { /// Maps the output of a system [`Action`] using the provided closure. pub fn map( -- cgit