pub struct AutosleepGuard {
autosleep: Autosleep,
original: bool,
restored: bool,
}Expand description
Restores the autosleep setting that the guard found when it was created.
AutosleepGuard::restore restores it and reports errors. Dropping the
guard restores it too, for example after a panic, and prints errors.
Fields§
§autosleep: Autosleep§original: bool§restored: boolImplementations§
Source§impl AutosleepGuard
impl AutosleepGuard
Sourcepub fn is_enabled(&self) -> Result<bool, Error>
pub fn is_enabled(&self) -> Result<bool, Error>
Sourcepub fn restore(self) -> Result<bool, Error>
pub fn restore(self) -> Result<bool, Error>
Writes the original setting back if it changed. Returns whether it wrote the setting.
§Errors
Returns an error if the setting can’t be read or written.
const fn original_text(&self) -> &'static str
Sourcefn write_back(&self) -> Result<bool, Error>
fn write_back(&self) -> Result<bool, Error>
Returns whether it wrote the setting.
Trait Implementations§
Source§impl Debug for AutosleepGuard
impl Debug for AutosleepGuard
Source§impl Drop for AutosleepGuard
impl Drop for AutosleepGuard
Auto Trait Implementations§
impl Freeze for AutosleepGuard
impl RefUnwindSafe for AutosleepGuard
impl Send for AutosleepGuard
impl Sync for AutosleepGuard
impl Unpin for AutosleepGuard
impl UnsafeUnpin for AutosleepGuard
impl UnwindSafe for AutosleepGuard
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