chore: cargo fmt & geoclue docs
This commit is contained in:
parent
c83767c7e5
commit
8b9767f6ce
7 changed files with 199 additions and 191 deletions
|
|
@ -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(())
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(())
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue