1
0
Fork 0
firefox/third_party/rust/dbus/examples/client.rs
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

14 lines
501 B
Rust

extern crate dbus;
use dbus::{Connection, BusType, Message};
use dbus::arg::Array;
fn main() {
let c = Connection::get_private(BusType::Session).unwrap();
let m = Message::new_method_call("org.freedesktop.DBus", "/", "org.freedesktop.DBus", "ListNames").unwrap();
let r = c.send_with_reply_and_block(m, 2000).unwrap();
// ListNames returns one argument, which is an array of strings.
let arr: Array<&str, _> = r.get1().unwrap();
for name in arr { println!("{}", name); }
}