WakeLockProvider

Trait WakeLockProvider 

Source
pub trait WakeLockProvider: Send + Sync {
    // Required methods
    fn acquire(&self, type_: WakeLockType) -> Result<(), Box<dyn Error>>;
    fn release(&self, type_: WakeLockType) -> Result<(), Box<dyn Error>>;
}
Expand description

Trait for platform-specific wake lock support.

Implementations are responsible for interacting with the OS to prevent the screen (or other resources) from sleeping while a wake lock is held.

Required Methods§

Source

fn acquire(&self, type_: WakeLockType) -> Result<(), Box<dyn Error>>

Acquire a wake lock of the given type, preventing the associated resource from sleeping. Called when the aggregate lock count transitions from 0 to 1. Returns an error if the OS fails to grant the lock.

Source

fn release(&self, type_: WakeLockType) -> Result<(), Box<dyn Error>>

Release a previously acquired wake lock of the given type, allowing the resource to sleep. Called when the aggregate lock count transitions from N to 0.

Implementors§