Struct appliance::Appliance[][src]

pub struct Appliance<M> { /* fields omitted */ }

A stateful entity that only allows to interact with via handling messages.

Implementations

impl<'a, M: Send + 'static> Appliance<M>[src]

pub fn new_bounded<S: Send + 'a>(
    executor: &Executor<'a>,
    state: S,
    handler: impl Fn(&mut S, M) + Send + 'a,
    size: usize
) -> Self
[src]

Creates a new appliance with a bounded message buffer, a state, and a handler.

pub fn new_unbounded<S: Send + 'a>(
    executor: &Executor<'a>,
    state: S,
    handler: impl Fn(&mut S, M) + Send + 'a
) -> Self
[src]

Creates a new appliance with an unbounded message buffer, a state, and a handler.

pub fn send(&self, message: M) -> Result<(), Error>[src]

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

pub fn send_and_wait(&self, message: M) -> Result<(), Error>[src]

Sends a message to the current appliance and waits indefinitely for the message to be handled. This blocking method is a fit for callers who must be assured that the message has been handled. It is supposed to be used less often then send as it may suffer a performance hit due to synchronization with the handling loop.

Trait Implementations

impl<M: Debug> Debug for Appliance<M>[src]

Auto Trait Implementations

impl<M> !RefUnwindSafe for Appliance<M>[src]

impl<M> Send for Appliance<M> where
    M: Send
[src]

impl<M> Sync for Appliance<M> where
    M: Send
[src]

impl<M> Unpin for Appliance<M>[src]

impl<M> !UnwindSafe for Appliance<M>[src]

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.