Struct Autosleep
pub struct Autosleep {
path: PathBuf,
}Expand description
Control of the kernel’s autosleep feature.
With autosleep enabled, the kernel suspends to memory whenever no wake lock is held.
The autosleep file has mode 0644 and belongs to root. Any user can read it, but only root can write it. A write waits for the kernel to abort a running suspend attempt. That includes a file system sync.
Fields§
§path: PathBufImplementations§
§impl Autosleep
impl Autosleep
pub const DEFAULT_PATH: &'static str = "/sys/power/autosleep"
pub const DEFAULT_PATH: &'static str = "/sys/power/autosleep"
Default path of the autosleep file.
pub fn new() -> Self
pub fn new() -> Self
Creates a handle for Self::DEFAULT_PATH.
pub fn set_enabled(&self, enabled: bool) -> Result<(), Error>
pub fn set_enabled(&self, enabled: bool) -> Result<(), Error>
pub fn is_enabled(&self) -> Result<bool, Error>
pub fn is_enabled(&self) -> Result<bool, Error>
fn write(&self, value: &[u8]) -> Result<(), Error>
fn error(&self, source: Error) -> Error
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Autosleep
impl RefUnwindSafe for Autosleep
impl Send for Autosleep
impl Sync for Autosleep
impl Unpin for Autosleep
impl UnsafeUnpin for Autosleep
impl UnwindSafe for Autosleep
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more