chore: cargo fmt & geoclue docs

This commit is contained in:
Ashley Wulber 2024-02-19 11:28:20 -05:00 committed by Ashley Wulber
parent c83767c7e5
commit 8b9767f6ce
7 changed files with 199 additions and 191 deletions

View file

@ -6,21 +6,21 @@ extern crate upower_dbus;
use upower_dbus::UPowerProxy;
fn main() -> zbus::Result<()> {
futures::executor::block_on(async move {
let connection = zbus::Connection::system().await?;
futures::executor::block_on(async move {
let connection = zbus::Connection::system().await?;
let upower = UPowerProxy::new(&connection).await?;
let upower = UPowerProxy::new(&connection).await?;
let device = upower.get_display_device().await?;
let device = upower.get_display_device().await?;
println!("BatteryLevel: {:?}", device.battery_level().await);
println!("IconName: {:?}", device.icon_name().await);
println!("IsPresent: {:?}", device.is_present().await);
println!("Online: {:?}", device.online().await);
println!("Percentage: {:?}", device.percentage().await);
println!("State: {:?}", device.state().await);
println!("Type: {:?}", device.type_().await);
println!("BatteryLevel: {:?}", device.battery_level().await);
println!("IconName: {:?}", device.icon_name().await);
println!("IsPresent: {:?}", device.is_present().await);
println!("Online: {:?}", device.online().await);
println!("Percentage: {:?}", device.percentage().await);
println!("State: {:?}", device.state().await);
println!("Type: {:?}", device.type_().await);
Ok(())
})
Ok(())
})
}

View file

@ -7,19 +7,19 @@ use futures::stream::StreamExt;
use upower_dbus::UPowerProxy;
fn main() -> zbus::Result<()> {
futures::executor::block_on(async move {
let connection = zbus::Connection::system().await?;
futures::executor::block_on(async move {
let connection = zbus::Connection::system().await?;
let upower = UPowerProxy::new(&connection).await?;
let upower = UPowerProxy::new(&connection).await?;
println!("On Battery: {:?}", upower.on_battery().await);
println!("On Battery: {:?}", upower.on_battery().await);
let mut stream = upower.receive_on_battery_changed().await;
let mut stream = upower.receive_on_battery_changed().await;
while let Some(event) = stream.next().await {
eprintln!("{:?}", event.get().await);
}
while let Some(event) = stream.next().await {
eprintln!("{:?}", event.get().await);
}
Ok(())
})
Ok(())
})
}