Debian Codegraph @

third_party/rust/dbus/examples/client.rs

raw
1 extern crate dbus;
2
3 use dbus::{Connection, BusType, Message};
4 use dbus::arg::Array;
5
6 fn main() {
7 let c = Connection::get_private(BusType::Session).unwrap();
8 let m = Message::new_method_call("org.freedesktop.DBus", "/", "org.freedesktop.DBus", "ListNames").unwrap();
9 let r = c.send_with_reply_and_block(m, 2000).unwrap();
10 // ListNames returns one argument, which is an array of strings.
11 let arr: Array<&str, _> = r.get1().unwrap();
12 for name in arr { println!("{}", name); }
13 }
14