Struct appliance::Appliance [−][src]
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]
executor: &Executor<'a>,
state: S,
handler: impl Fn(&mut S, M) + Send + 'a,
size: usize
) -> Self
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]
executor: &Executor<'a>,
state: S,
handler: impl Fn(&mut S, M) + Send + 'a
) -> Self
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
Auto Trait Implementations
impl<M> !RefUnwindSafe for Appliance<M>
[src]
impl<M> Send for Appliance<M> where
M: Send,
[src]
M: Send,
impl<M> Sync for Appliance<M> where
M: Send,
[src]
M: Send,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,