acpid_plug

Crates.ioacpid_plug
lib.rsacpid_plug
version0.1.2
sourcesrc
created_at2024-04-05 06:34:38.239747
updated_at2024-04-05 12:08:53.308122
descriptionListen to AC adapter plug events from acpid
homepage
repositoryhttps://github.com/pop-os/acpid-plug
max_upload_size
id1197055
size33,957
Michael Murphy (mmstick)

documentation

README

acpid-plug

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(())
}
Commit count: 3

cargo fmt