#nosleep #powersave #caffeine

nosleep-types

Block power save mode cross platform

5 releases

Uses new Rust 2021

0.2.1 Nov 20, 2022
0.2.0 May 8, 2022
0.2.0-rc.2 May 7, 2022
0.2.0-rc.1 May 4, 2022

#1132 in Rust patterns

Download history 18/week @ 2022-08-13 15/week @ 2022-08-20 17/week @ 2022-08-27 20/week @ 2022-09-03 23/week @ 2022-09-10 16/week @ 2022-09-17 26/week @ 2022-09-24 33/week @ 2022-10-01 24/week @ 2022-10-08 15/week @ 2022-10-15 24/week @ 2022-10-22 28/week @ 2022-10-29 29/week @ 2022-11-05 16/week @ 2022-11-12 69/week @ 2022-11-19 16/week @ 2022-11-26

138 downloads per month
Used in 5 crates (4 directly)

MIT license

2KB

nosleep

Continuous Integration (macOS) Continuous Integration (Linux) Continuous Integration (Windows) license version Crates.io

Cross-platform library to block the power save function in the OS.

use nosleep::{NoSleep, NoSleepType};
let mut nosleep = NoSleep::new().unwrap();
nosleep
    .start(NoSleepType::PreventUserIdleDisplaySleep)
    .unwrap();
std::thread::sleep(std::time::Duration::from_millis(180_000));
nosleep.stop().unwrap(); // Not strictly needed

Dependencies

~0.3–0.8MB
~18K SLoC