Module dbus::tree[][src]

Contains functionality for dispatching methods on a D-Bus "server".

Example

use dbus::{tree, Connection, BusType};
let f = tree::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().append("Thanks!"))) }
        ).out_arg("s"))
));

let c = Connection::get_private(BusType::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.

MethodErr

A D-Bus Method Error, containing an error name and a description.

MethodInfo

Contains information about the incoming method call.

ObjectPath

A D-Bus Object Path.

PropInfo

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.

TreeServer

An iterator adapter that handles incoming method calls.

Enums

Access

The possible access characteristics a Property can have.

EmitsChangedSignal

Enumerates the different signaling behaviors a Property can have to being changed.

Traits

DataType

Associated data for different objects in a tree.

MethodType

A helper trait used internally to make the tree generic over MTFn, MTFnMut and MTSync.

Type Definitions

MethodResult

Result containing the Messages returned from the Method, or a MethodErr.