Struct appliance::Descriptor[][src]

pub struct Descriptor<'a, A: ?Sized> { /* fields omitted */ }

Appliance descriptor is a cloneable object which allows to send messages to the appliance.

Once all descriptors to the appliance are dropped, the appliance will terminate its event loop and be destroyed.

Implementations

impl<'a, A: ?Sized + 'a> Descriptor<'a, A>[src]

pub fn send_sync<M>(&self, message: M) -> Result<(), Error<M>> where
    M: HandledBy<A> + 'a, 
[src]

Sends a message to the current appliance without waiting for the message to be handled.

pub async fn send_async<M>(&self, message: M) -> Result<(), Error<M>> where
    M: HandledBy<A> + 'a, 
[src]

Does conceptually the same thing as send_sync but gets intended to be used in async context.

pub fn send_and_wait_sync<M>(
    &self,
    message: M,
    timeout: Option<Duration>
) -> Result<M::Result, Error<M>> where
    M: HandledBy<A> + 'a, 
[src]

Sends a message to the current appliance and waits forever, if timeout is None, or for only given time for the message to be handled. This synchronous blocking method is a fit for callers who don’t use async execution and must be assured that the message has been handled. Note, it is supposed to be used less often than send as it may suffer a significant performance hit due to synchronization with the handling loop.

pub async fn send_and_wait_async<M>(
    &self,
    message: M,
    timeout: Option<Duration>
) -> Result<M::Result, Error<M>> where
    M: HandledBy<A> + 'a, 
[src]

Does conceptually the same thing as send_and_wait_sync but gets intended to be used in async context. This method is well suited for waiting for a result.

Trait Implementations

impl<'a, A: ?Sized + 'a> Clone for Descriptor<'a, A>[src]

impl<'a, A: ?Sized + 'a> Debug for Descriptor<'a, A>[src]

Auto Trait Implementations

impl<'a, A> !RefUnwindSafe for Descriptor<'a, A>

impl<'a, A: ?Sized> Send for Descriptor<'a, A>

impl<'a, A: ?Sized> Sync for Descriptor<'a, A>

impl<'a, A: ?Sized> Unpin for Descriptor<'a, A>

impl<'a, A> !UnwindSafe for Descriptor<'a, A>

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.