zbus_systemd 0.26000.0

A pure-Rust library to interact with systemd DBus services
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
type ExResult<T> = Result<T, Box<dyn std::error::Error + 'static>>;

fn main() {
    let rt = tokio::runtime::Runtime::new().unwrap();
    let ret = rt.block_on(run());
    if let Err(e) = ret {
        eprintln!("Error: {}", e);
        std::process::exit(1);
    }
}

async fn run() -> ExResult<()> {
    let conn = zbus::Connection::system().await?;
    let manager = zbus_systemd::systemd1::ManagerProxy::new(&conn).await?;
    let target = manager.get_default_target().await?;
    println!("Default target: '{}'", target);
    Ok(())
}