Cross-platform library to block the power save functionality in the OS.
# use Error;
# use ;
# use *;
#
Cross-platform library to block the power save functionality in the OS.
# use std::error::Error;
# use std::{time::Duration, thread};
# use nosleep::*;
# fn main() -> Result<(), Box<dyn Error>> {
let nosleep = NoSleep::new()?;
nosleep.start(NoSleepType::PreventUserIdleDisplaySleep)?;
// Depending on the platform, the block will hold
// until either nosleep will be dropped (Linux)
// or the process exits (macOS) or you manually
// call `nosleep.stop()`
# Ok(())
# }