diff options
Diffstat (limited to 'src/facility.rs')
| -rw-r--r-- | src/facility.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/facility.rs b/src/facility.rs index 56afaf4..182b6bb 100644 --- a/src/facility.rs +++ b/src/facility.rs @@ -3,6 +3,7 @@ use crate::error::Result; use std::any::Any; use std::collections::BTreeMap; +use async_executor::StaticExecutor; use bitflags::bitflags; pub use envsys::EnvSys; @@ -55,7 +56,7 @@ pub trait CreatableFacility: Facility + Sized { * As far as why the compiler can't reach that conclusion on its own and * skip it, we have no specific information. */ - async fn new() -> Result<Self>; + async fn new(executor: &'static StaticExecutor) -> Result<Self>; /* The only way to coerce to dyn is to return as it! */ fn as_box<'a>(self) -> Box<dyn Facility + 'a> @@ -76,10 +77,12 @@ bitflags! { } impl FacilityType { - pub async fn new(&self) -> Result<Box<dyn Facility>> { + pub async fn new(&self, executor: &'static StaticExecutor) + -> Result<Box<dyn Facility>> + { match self { - &FacilityType::ENVSYS => Ok(EnvSys::new().await?.as_box()), - &FacilityType::I3 => Ok(I3::new().await?.as_box()), + &FacilityType::ENVSYS => Ok(EnvSys::new(executor).await?.as_box()), + &FacilityType::I3 => Ok(I3::new(executor).await?.as_box()), _ => todo!() } } |