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§
Sourcefn suspend(&self) -> impl Future<Output = ()> + Send
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.
Sourcefn resume(&self) -> impl Future<Output = ()> + Send
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.
Sourcefn suspend_enabled(&self) -> bool
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.