Expand description
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(())
}
Structs§
- AcPlug
Events - A stream of power adapter plug events.
Enums§
- Event
- Whether the power adapter has been plugged or unplugged.
Functions§
- connect
- Listens for AC plug events from
/var/run/acpid.socket
. - with_
socket - Listens for AC plug events from a custom socket.