tokio-dbus-runtime 0.2.0

Runtime support for code generated by tokio-dbus-codegen.
Documentation

tokio-dbus-runtime

Runtime support for the code generated by tokio-dbus-codegen.

Where tokio-dbus speaks in borrowed views over a message buffer, this crate speaks in the owned Rust types a caller would reach for anyway: [String], [Vec], HashMap and tuples, with a [Value] standing in for a variant. That convenience is paid for with a copy of every message which crosses the boundary, so reach for the low level API when that matters.

Examples

use tokio_dbus::{ObjectPath, Signature};
use tokio_dbus_runtime::{Arguments, Connection};

const PATH: &ObjectPath = ObjectPath::new_const(b"/org/freedesktop/DBus");

let mut c = Connection::session_bus().await?;

let mut arguments = Arguments::new(Signature::STRING)?;
arguments.store("org.freedesktop.DBus");

let reply = c
    .call(
        "org.freedesktop.DBus",
        PATH,
        "org.freedesktop.DBus",
        "GetNameOwner",
        &arguments,
    )
    .await?;

let owner = reply.read::<String>()?;
println!("{owner}");