[][src]Struct dbus_tree::Tree

pub struct Tree<M: MethodType<D>, D: DataType> { /* fields omitted */ }

A collection of object paths.

Implementations

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

pub fn add<I: Into<Arc<ObjectPath<M, D>>>>(self, s: I) -> Self[src]

Builder function that adds an object path to this tree.

Note: This does not register a path with the connection, so if the tree is currently registered, you might want to call Connection::register_object_path to add the path manually.

pub fn get(&self, p: &Path<'static>) -> Option<&Arc<ObjectPath<M, D>>>[src]

Get a reference to an object path from the tree.

pub fn iter<'a>(&'a self) -> Iter<'a, ObjectPath<M, D>>

Notable traits for Iter<'a, V>

impl<'a, V: 'a> Iterator for Iter<'a, V> type Item = &'a Arc<V>;
[src]

Iterates over object paths in this tree.

pub fn insert<I: Into<Arc<ObjectPath<M, D>>>>(&mut self, s: I)[src]

Non-builder function that adds an object path to this tree.

Note: This does not register a path with the connection, so if the tree is currently registered, you might want to call Connection::register_object_path to add the path manually.

pub fn remove(&mut self, p: &Path<'static>) -> Option<Arc<ObjectPath<M, D>>>[src]

Remove a object path from the Tree. Returns the object path removed, or None if not found.

Note: This does not unregister a path with the connection, so if the tree is currently registered, you might want to call Connection::unregister_object_path to remove the path manually.

pub fn set_registered(&self, c: &Connection, b: bool) -> Result<(), Error>[src]

Registers or unregisters all object paths in the tree to a ffidisp::Connection.

pub fn run<'a, I: Iterator<Item = ConnectionItem>>(
    &'a self,
    c: &'a Connection,
    i: I
) -> TreeServer<'a, I, M, D>

Notable traits for TreeServer<'a, I, M, D>

impl<'a, I: Iterator<Item = ConnectionItem>, M: 'a + MethodType<D>, D: DataType + 'a> Iterator for TreeServer<'a, I, M, D> type Item = ConnectionItem;
[src]

This method takes an ConnectionItem iterator (you get it from Connection::iter()) and handles all matching items. Non-matching items (e g signals) are passed through.

pub fn handle(&self, m: &Message) -> Option<Vec<Message>>[src]

Handles a message.

Will return None in case the object path was not found in this tree, or otherwise a list of messages to be sent back.

pub fn process_channel(
    &self,
    channel: &Channel,
    timeout: Duration
) -> Result<bool, Error>
[src]

Tries to handle an incoming message from the provided channel if there is one. If there isn't one, it will wait up to timeout

pub fn get_data(&self) -> &D::Tree[src]

Get associated data

impl<M: MethodType<D> + 'static, D: DataType + 'static> Tree<M, D>[src]

pub fn start_receive_sync<C>(self, connection: &C) where
    C: MatchingReceiver<F = Box<dyn FnMut(Message, &C) -> bool + Send + Sync>> + Sender,
    D::Tree: Send + Sync,
    D::ObjectPath: Send + Sync,
    D::Interface: Send + Sync,
    D::Property: Send + Sync,
    D::Method: Send + Sync,
    D::Signal: Send + Sync,
    M::Method: Send + Sync,
    M::GetProp: Send + Sync,
    M::SetProp: Send + Sync
[src]

Connects a SyncConnection with a Tree so that incoming method calls are handled.

The tree needs to be of type MTSync.

pub fn start_receive_send<C>(self, connection: &C) where
    C: MatchingReceiver<F = Box<dyn FnMut(Message, &C) -> bool + Send>> + Sender,
    D::Tree: Send + Sync,
    D::ObjectPath: Send + Sync,
    D::Interface: Send + Sync,
    D::Property: Send + Sync,
    D::Method: Send + Sync,
    D::Signal: Send + Sync,
    M::Method: Send + Sync,
    M::GetProp: Send + Sync,
    M::SetProp: Send + Sync
[src]

Connects a Connection with a Tree so that incoming method calls are handled.

The tree needs to be of type MTSync.

pub fn start_receive<C>(self, connection: &C) where
    C: MatchingReceiver<F = Box<dyn FnMut(Message, &C) -> bool>> + Sender
[src]

Connects a LocalConnection with a Tree so that incoming method calls are handled.

Trait Implementations

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

impl<M: Default + MethodType<D>, D: Default + DataType> Default for Tree<M, D> where
    D::Tree: Default
[src]

impl<M: MethodType<D>, D: DataType> MsgHandler for Tree<M, D>[src]

Auto Trait Implementations

impl<M, D> RefUnwindSafe for Tree<M, D> where
    <M as MethodType<D>>::GetProp: RefUnwindSafe,
    <D as DataType>::Interface: RefUnwindSafe,
    <D as DataType>::Method: RefUnwindSafe,
    <M as MethodType<D>>::Method: RefUnwindSafe,
    <D as DataType>::ObjectPath: RefUnwindSafe,
    <D as DataType>::Property: RefUnwindSafe,
    <M as MethodType<D>>::SetProp: RefUnwindSafe,
    <D as DataType>::Signal: RefUnwindSafe,
    <D as DataType>::Tree: RefUnwindSafe

impl<M, D> Send for Tree<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>::ObjectPath: Send + Sync,
    <D as DataType>::Property: Send + Sync,
    <M as MethodType<D>>::SetProp: Send + Sync,
    <D as DataType>::Signal: Send + Sync,
    <D as DataType>::Tree: Send

impl<M, D> Sync for Tree<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>::ObjectPath: Send + Sync,
    <D as DataType>::Property: Send + Sync,
    <M as MethodType<D>>::SetProp: Send + Sync,
    <D as DataType>::Signal: Send + Sync,
    <D as DataType>::Tree: Sync

impl<M, D> Unpin for Tree<M, D> where
    <D as DataType>::Tree: Unpin

impl<M, D> UnwindSafe for Tree<M, D> where
    <M as MethodType<D>>::GetProp: RefUnwindSafe,
    <D as DataType>::Interface: RefUnwindSafe,
    <D as DataType>::Method: RefUnwindSafe,
    <M as MethodType<D>>::Method: RefUnwindSafe,
    <D as DataType>::ObjectPath: RefUnwindSafe,
    <D as DataType>::Property: RefUnwindSafe,
    <M as MethodType<D>>::SetProp: RefUnwindSafe,
    <D as DataType>::Signal: RefUnwindSafe,
    <D as DataType>::Tree: UnwindSafe

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