Crates.io | acpid_plug |
lib.rs | acpid_plug |
version | 0.1.2 |
source | src |
created_at | 2024-04-05 06:34:38.239747 |
updated_at | 2024-04-05 12:08:53.308122 |
description | Listen to AC adapter plug events from acpid |
homepage | |
repository | https://github.com/pop-os/acpid-plug |
max_upload_size | |
id | 1197055 |
size | 33,957 |
Rust crate for listening to AC adapter plug events on Linux from acpid
.
use futures_util::StreamExt;
#[tokio::main(flavor = "current_thread")]
async fn main() -> std::io::Result<()> {
let mut ac_plug_events = acpid_plug::connect().await?;
while let Some(event) = ac_plug_events.next().await {
match event {
Ok(event) => println!("{:?}", event),
Err(why) => eprintln!("error: {}", why),
}
}
Ok(())
}