trait Platform {
// Required methods
fn can(&mut self, tr: &Translator) -> Done;
fn on(&mut self, ask: &Ask, kept: &mut Kept, tr: &Translator) -> Done;
fn off(&mut self, which: Which, others: &[Ask], kept: &mut Kept) -> Done;
// Provided methods
fn holds(&self, _which: Which) -> bool { ... }
fn system_on(&mut self) -> Option<bool> { ... }
fn system_off(&mut self, _consent: bool) -> bool { ... }
fn still_on(&mut self) -> Option<Done> { ... }
fn listen(&mut self, _told: Arc<dyn Fn(bool) + Send + Sync>) { ... }
fn outlives(&mut self, _kept: &Kept) -> bool { ... }
}Expand description
One system’s side, behind a trait: the logic below is tested with a stand-in.
Required Methods§
Sourcefn can(&mut self, tr: &Translator) -> Done
fn can(&mut self, tr: &Translator) -> Done
What this device allows, changing nothing.
Provided Methods§
Sourcefn holds(&self, _which: Which) -> bool
fn holds(&self, _which: Which) -> bool
Whether what on did for which still holds in this process.
Sourcefn system_on(&mut self) -> Option<bool>
fn system_on(&mut self) -> Option<bool>
This device’s own do-not-disturb, as its system says it now; none
where it cannot be read. (A computer’s says it through still_on.)
Sourcefn system_off(&mut self, _consent: bool) -> bool
fn system_off(&mut self, _consent: bool) -> bool
Sioul’s do-not-disturb went off here: the system’s own off too, once,
where Sioul can (consent: GNOME’s yes). Whether something was turned off.
Sourcefn still_on(&mut self) -> Option<Done>
fn still_on(&mut self) -> Option<Done>
While Sioul’s do-not-disturb is off here: the system’s own still on, said.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".