Debian Codegraph @

third_party/rust/dbus/src/tree/mod.rs

raw
1 //! Contains functionality for dispatching methods on a D-Bus "server".
2 //!
3 //! # Example
4 //! ```rust,no_run
5 //! use dbus::{tree, Connection, BusType};
6 //! let f = tree::Factory::new_fn::<()>();
7 //! /* Add a method returning "Thanks!" on interface "com.example.dbus.rs"
8 //! on object path "/example". */
9 //! let t = f.tree(()).add(f.object_path("/example", ()).introspectable()
10 //! .add(f.interface("com.example.dbus.rs", ())
11 //! .add_m(f.method("CallMe", (), |m| {
12 //! Ok(vec!(m.msg.method_return().append("Thanks!"))) }
13 //! ).out_arg("s"))
14 //! ));
15 //!
16 //! let c = Connection::get_private(BusType::Session).unwrap();
17 //! t.set_registered(&c, true).unwrap();
18 //! c.add_handler(t);
19 //! /* Run forever */
20 //! loop { c.incoming(1000).next(); }
21 //! ```
22 //!
23 //! See `examples/server.rs` and `examples/adv_server.rs` for more thorough examples.
24
25 mod utils;
26 mod methodtype;
27 mod leaves;
28 mod objectpath;
29 mod factory;
30
31 pub use self::utils::{Argument, Iter};
32 pub use self::methodtype::{MethodErr, MethodInfo, PropInfo, MethodResult, MethodType, DataType, MTFn, MTFnMut, MTSync};
33 pub use self::leaves::{Method, Signal, Property, Access, EmitsChangedSignal};
34 pub use self::objectpath::{Interface, ObjectPath, Tree, TreeServer};
35 pub use self::factory::Factory;