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