Struct dbus::tree::Factory
[−]
[src]
pub struct Factory<M>(_);
The factory is used to create object paths, interfaces, methods etc.
There are three factories:
Fn - all methods are Fn()
.
FnMut - all methods are FnMut()
. This means they can mutate their environment,
which has the side effect that if you call it recursively, it will RefCell panic.
Sync - all methods are Fn() + Send + Sync + 'static
. This means that the methods
can be called from different threads in parallel.
Methods
impl<'a> Factory<MethodFn<'a>>
[src]
fn new_fn() -> Self
Creates a new factory for single-thread use.
fn method<'b, H: 'b, T>(&self, t: T, handler: H) -> Method<MethodFn<'b>> where H: Fn(&Message, &ObjectPath<MethodFn<'b>>, &Tree<MethodFn<'b>>) -> MethodResult, T: Into<Member<'static>>
Creates a new method for single-thread use.
fn property<'b, T: Into<String>, I: Into<MessageItem>>(&self, t: T, i: I) -> Property<MethodFn<'b>>
Creates a new property for single-thread use.
fn interface<'b, T: Into<IfaceName<'static>>>(&self, t: T) -> Interface<MethodFn<'b>>
Creates a new interface for single-thread use.
fn tree<'b>(&self) -> Tree<MethodFn<'b>>
Creates a new tree for single-thread use.
fn object_path<'b, T: Into<Path<'static>>>(&self, t: T) -> ObjectPath<MethodFn<'b>>
Creates a new object path for single-thread use.
impl<'a> Factory<MethodFnMut<'a>>
[src]
fn new_fnmut() -> Self
Creates a new factory for single-thread + mutable fns use.
fn method<'b, H: 'b, T>(&self, t: T, handler: H) -> Method<MethodFnMut<'b>> where H: FnMut(&Message, &ObjectPath<MethodFnMut<'b>>, &Tree<MethodFnMut<'b>>) -> MethodResult, T: Into<Member<'static>>
Creates a new method for single-thread use. This method can mutate its environment, so it will panic in case it is called recursively.
fn property<'b, T: Into<String>, I: Into<MessageItem>>(&self, t: T, i: I) -> Property<MethodFnMut<'b>>
Creates a new mutable property for single-thread use.
fn interface<'b, T: Into<IfaceName<'static>>>(&self, t: T) -> Interface<MethodFnMut<'b>>
Creates a new mutable interface for single-thread use.
fn tree<'b>(&self) -> Tree<MethodFnMut<'b>>
Creates a new mutable tree for single-thread use.
fn object_path<'b, T: Into<Path<'static>>>(&self, t: T) -> ObjectPath<MethodFnMut<'b>>
Creates a new mutable object path for single-thread use.
impl Factory<MethodSync>
[src]
fn new_sync() -> Self
Creates a new factory for multi-thread use. Trees created will be able to Send and Sync, i e, it can handle several messages in parallel.
fn method<H, T>(&self, t: T, handler: H) -> Method<MethodSync> where H: Fn(&Message, &ObjectPath<MethodSync>, &Tree<MethodSync>) -> MethodResult + Send + Sync + 'static, T: Into<Member<'static>>
Creates a new method for multi-thread use. This puts bounds on the callback to enable it to be called from several threads in parallel.
fn property<T: Into<String>, I: Into<MessageItem>>(&self, t: T, i: I) -> Property<MethodSync>
Creates a new property for multi-threaded use.
fn interface<T: Into<IfaceName<'static>>>(&self, t: T) -> Interface<MethodSync>
Creates a new interface for multi-threaded use.
fn tree(&self) -> Tree<MethodSync>
Creates a new tree for multi-threaded use.
fn object_path<T: Into<Path<'static>>>(&self, t: T) -> ObjectPath<MethodSync>
Creates a new object path for multi-threaded use.
impl<M> Factory<M>
[src]
impl<M: MethodType> Factory<M>
[src]
fn method_sync<H, T>(&self, t: T, handler: H) -> Method<M> where H: Fn(&Message, &ObjectPath<M>, &Tree<M>) -> MethodResult + Send + Sync + 'static, T: Into<Member<'static>>
Creates a new method with bounds enough to be used in all trees.