use crate::error::Result; use crate::facility::FacilityType; use std::time::Duration; pub use battery::BatteryModule; pub use time::TimeModule; pub mod battery; pub mod time; /* As with Facility, we need a separate trait for the stuff that wouldn't be * dyn-compatible. */ pub trait CreatableModule: Module + Sized { const REQUIRED_FACILITIES: FacilityType; fn new() -> Result; /* The only way to coerce to dyn is to return as it! */ fn as_box<'a>(self) -> Box where Self: 'a { Box::new(self) } } pub trait Module { fn format(&mut self) -> String; fn sleep_duration(&self) -> Option; }