Expand description
§bussy
bussy is a simple interface layered on top of the low-level zbus interfaces.
It provides the the following advantages:
- bussy is completely async but does not require you to use async/await. This allows you to use bussy in environments where using async code directly is not possible.
- All outgoing messages are sent in the order in which you call the respective functions. This applies even if the function returns a future and you don’t await it immediately.
- bussy supports pipelining. All requests are sent immediately even if you do not await the response. This reduces the number of roundtrips for n method calls from n to 1.
- When you handle a method call, you get a PendingReply object that you can hold on to for as long as you want without blocking any other progress. You can then reply to the call whenever you are ready.
- All incoming messages are handled in a single thread in order. This means that, if you get a reply to a method call and receive a signal, the order in which your code is invoked is exactly the same as the order in which the peer sent these message. (Note that, if you are using async/await syntax for method calls, then tokio’s scheduling of tasks might get in the way of this.)
§Example
let zbus_conn = zbus::Connection::session().await.unwrap();
let conn_holder = bussy::Connection::wrap(&zbus_conn);
let conn = &conn_holder.connection;
let res = conn.call::<String>(
WellKnownName::from_static_str_unchecked("org.freedesktop.DBus"),
InterfaceName::from_static_str_unchecked("org.freedesktop.DBus"),
ObjectPath::from_static_str_unchecked("/org/freedesktop/DBus"),
MemberName::from_static_str_unchecked("GetNameOwner"),
&("org.freedesktop.DBus"), // the request body
).await;
println!("The name org.freedesktop.DBus is owned by {}", res.unwrap());Structs§
- A pending call.
- A future representing a method call response.
- A bussy connection.
- A holder object for a bussy Connection.
- A builder for a MatchRule.
- An exported object.
- A pending reply to a method call.
- An installed signal handler.
Enums§
- An error.