Skip to main content

Platform

Trait Platform 

Source
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§

Source

fn can(&mut self, tr: &Translator) -> Done

What this device allows, changing nothing.

Source

fn on(&mut self, ask: &Ask, kept: &mut Kept, tr: &Translator) -> Done

ask’s pause silenced, or brought up to date; idempotent given kept.

Source

fn off(&mut self, which: Which, others: &[Ask], kept: &mut Kept) -> Done

which’s pause no longer silenced, and nothing else; others: the pauses still on here.

Provided Methods§

Source

fn holds(&self, _which: Which) -> bool

Whether what on did for which still holds in this process.

Source

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.)

Source

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.

Source

fn still_on(&mut self) -> Option<Done>

While Sioul’s do-not-disturb is off here: the system’s own still on, said.

Source

fn listen(&mut self, _told: Arc<dyn Fn(bool) + Send + Sync>)

Follows this system’s own do-not-disturb, telling each change heard.

Source

fn outlives(&mut self, _kept: &Kept) -> bool

Whether what Sioul turned on outlives Sioul’s process (kept, as Sioul quits).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<D: Desk> Platform for Desktop<D>