[][src]Struct dbus::tree::Factory

pub struct Factory<M: MethodType<D>, D: DataType = ()>(_);

The factory is used to create object paths, interfaces, methods etc.

There are three factories:

MTFn - all methods are Fn().

MTFnMut - 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.

MTSync - all methods are Fn() + Send + Sync + 'static. This means that the methods can be called from different threads in parallel.

Implementations

impl Factory<MTFn<()>, ()>[src]

pub fn new_fn<D: DataType>() -> Factory<MTFn<D>, D>[src]

Creates a new factory for single-thread use.

pub fn new_fnmut<D: DataType>() -> Factory<MTFnMut<D>, D>[src]

Creates a new factory for single-thread use, where callbacks can mutate their environment.

pub fn new_sync<D: DataType>() -> Factory<MTSync<D>, D>[src]

Creates a new factory for multi-thread use.

impl<D: DataType> Factory<MTFn<D>, D>[src]

pub fn method<H, T>(
    &self,
    t: T,
    data: D::Method,
    handler: H
) -> Method<MTFn<D>, D> where
    H: 'static + Fn(&MethodInfo<MTFn<D>, D>) -> MethodResult,
    T: Into<Member<'static>>, 
[src]

Creates a new method for single-thread use.

impl<D: DataType> Factory<MTFnMut<D>, D>[src]

pub fn method<H, T>(
    &self,
    t: T,
    data: D::Method,
    handler: H
) -> Method<MTFnMut<D>, D> where
    H: 'static + FnMut(&MethodInfo<MTFnMut<D>, D>) -> MethodResult,
    T: Into<Member<'static>>, 
[src]

Creates a new method for single-thread use.

impl<D: DataType> Factory<MTSync<D>, D>[src]

pub fn method<H, T>(
    &self,
    t: T,
    data: D::Method,
    handler: H
) -> Method<MTSync<D>, D> where
    H: Fn(&MethodInfo<MTSync<D>, D>) -> MethodResult + Send + Sync + 'static,
    T: Into<Member<'static>>, 
[src]

Creates a new method for multi-thread use.

impl<M: MethodType<D>, D: DataType> Factory<M, D>[src]

pub fn property<A: Arg, T: Into<String>>(
    &self,
    name: T,
    data: D::Property
) -> Property<M, D>
[src]

Creates a new property.

A is used to calculate the type signature of the property.

pub fn signal<T: Into<Member<'static>>>(
    &self,
    name: T,
    data: D::Signal
) -> Signal<D>
[src]

Creates a new signal.

pub fn interface<T: Into<IfaceName<'static>>>(
    &self,
    name: T,
    data: D::Interface
) -> Interface<M, D>
[src]

Creates a new interface.

pub fn object_path<T: Into<Path<'static>>>(
    &self,
    name: T,
    data: D::ObjectPath
) -> ObjectPath<M, D>
[src]

Creates a new object path.

pub fn tree(&self, data: D::Tree) -> Tree<M, D>[src]

Creates a new tree.

pub fn method_sync<H, T>(
    &self,
    t: T,
    data: D::Method,
    handler: H
) -> Method<M, D> where
    H: Fn(&MethodInfo<M, D>) -> MethodResult + Send + Sync + 'static,
    T: Into<Member<'static>>, 
[src]

Creates a new method - usually you'll use "method" instead.

This is useful for being able to create methods in code which is generic over methodtype.

Trait Implementations

impl<M: Clone + MethodType<D>, D: Clone + DataType> Clone for Factory<M, D>[src]

impl<M: Debug + MethodType<D>, D: Debug + DataType> Debug for Factory<M, D>[src]

impl<M: MethodType<D>, D: DataType> From<Arc<IfaceCache<M, D>>> for Factory<M, D>[src]

Auto Trait Implementations

impl<M, D> RefUnwindSafe for Factory<M, D>

impl<M, D> Send for Factory<M, D> where
    <M as MethodType<D>>::GetProp: Send + Sync,
    <D as DataType>::Interface: Send + Sync,
    <D as DataType>::Method: Send + Sync,
    <M as MethodType<D>>::Method: Send + Sync,
    <D as DataType>::Property: Send + Sync,
    <M as MethodType<D>>::SetProp: Send + Sync,
    <D as DataType>::Signal: Send + Sync

impl<M, D> Sync for Factory<M, D> where
    <M as MethodType<D>>::GetProp: Send + Sync,
    <D as DataType>::Interface: Send + Sync,
    <D as DataType>::Method: Send + Sync,
    <M as MethodType<D>>::Method: Send + Sync,
    <D as DataType>::Property: Send + Sync,
    <M as MethodType<D>>::SetProp: Send + Sync,
    <D as DataType>::Signal: Send + Sync

impl<M, D> Unpin for Factory<M, D>

impl<M, D> UnwindSafe for Factory<M, D>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.