Trait SuspendableDriver

Source
pub trait SuspendableDriver: Driver {
    // Required methods
    fn suspend(&self) -> impl Future<Output = ()> + Send;
    fn resume(&self) -> impl Future<Output = ()> + Send;
    fn suspend_enabled(&self) -> bool;
}
Expand description

Implement this trait if you’d like to get notifications when the system is about to go into suspend and come out of resume.

Required Methods§

Source

fn suspend(&self) -> impl Future<Output = ()> + Send

Called prior the system entering suspend. The system is not guaranteed to enter suspend, but resume will be called regardless before a subsequent suspension attempt occurs.

Source

fn resume(&self) -> impl Future<Output = ()> + Send

Called after suspend to indicate the system is no longer in suspend. The system may not have actually entered suspension in between suspend and resume invocations.

Source

fn suspend_enabled(&self) -> bool

Returns whether or not suspend is enabled. If false is returned, suspend and resume methods will never be called.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§