Expand description
Contains functionality for dispatching methods on a D-Bus “server”.
§Example
use dbus_tree::Factory;
use dbus::ffidisp::Connection;
let f = Factory::new_fn::<()>();
/* Add a method returning "Thanks!" on interface "com.example.dbus.rs"
on object path "/example". */
let t = f.tree(()).add(f.object_path("/example", ()).introspectable()
.add(f.interface("com.example.dbus.rs", ())
.add_m(f.method("CallMe", (), |m| {
Ok(vec!(m.msg.method_return().append1("Thanks!"))) }
).out_arg("s"))
));
let c = Connection::new_session().unwrap();
t.set_registered(&c, true).unwrap();
c.add_handler(t);
/* Run forever */
loop { c.incoming(1000).next(); }
See examples/server.rs
and examples/adv_server.rs
for more thorough examples.
Structs§
- Argument
- A D-Bus Argument.
- Factory
- The factory is used to create object paths, interfaces, methods etc.
- Interface
- Represents a D-Bus interface.
- Iter
- Iterator struct, returned from iterator methods on Tree, Objectpath and Interface.
- MTFn
- An abstract type to represent Fn functions.
- MTFnMut
- An abstract type to represent FnMut functions.
- MTSync
- An abstract type to represent Fn + Send + Sync functions (that can be called from several threads in parallel).
- Method
- A D-Bus Method.
- Method
Err - A D-Bus Method Error, containing an error name and a description.
- Method
Info - Contains information about the incoming method call.
- Object
Path - A D-Bus Object Path.
- Prop
Info - Contains information about the incoming property get/set request.
- Property
- A D-Bus Property.
- Signal
- A D-Bus Signal.
- Tree
- A collection of object paths.
- Tree
Server - An iterator adapter that handles incoming method calls.
Enums§
- Access
- The possible access characteristics a Property can have.
- Emits
Changed Signal - Enumerates the different signaling behaviors a Property can have to being changed.
Traits§
- Data
Type - Associated data for different objects in a tree.
- Method
Type - A helper trait used internally to make the tree generic over MTFn, MTFnMut and MTSync.
Type Aliases§
- Method
Result - Result containing the Messages returned from the Method, or a MethodErr.