Struct meio::Address [−][src]
pub struct Address<A: Actor> { /* fields omitted */ }
Expand description
Address
to send messages to Actor
.
Can be compared each other to identify senders to
the same Actor
.
Implementations
Just sends an Action
to the Actor
.
pub fn instant<I>(&self, input: I) -> Result<(), Error> where
I: InstantAction,
A: InstantActionHandler<I>,
pub fn instant<I>(&self, input: I) -> Result<(), Error> where
I: InstantAction,
A: InstantActionHandler<I>,
Just sends an Action
to the Actor
.
Just sends an Action
to the Actor
.
pub fn interact<I>(&self, request: I) -> InteractionTask<I> where
I: Interaction,
A: ActionHandler<Interact<I>>,
pub fn interact<I>(&self, request: I) -> InteractionTask<I> where
I: Interaction,
A: ActionHandler<Interact<I>>,
Interacts with an Actor
and waits for the result of the Interaction
.
ActionHandler
required instead of InteractionHandler
to make it possible
to work with both types of handler, because ActionHandler
can be used
for long running interaction and prevent blocking of the actor’s routine.
To avoid blocking you shouldn’t await
the result of this Interaction
,
but create a Future
and await
in a separate coroutine of in a LiteTask
.
Waits when the Actor
will be terminated.
It consumes address, because it useless after termination.
Also it prevents blocking queue if Actor
uses it to detect
the right time for termination.
Attaches a Stream
of event to an Actor
.
Optimized for intensive streams. For moderate flow you still can
use ordinary Action
s and act
method calls.
It spawns a routine that groups multiple items into a single chunk
to reduce amount as async
calls of a handler.
Returns a Link
to an Actor
.
Link
is a convenient concept for creating wrappers for
Address
that provides methods instead of using message types
directly. It allows also to use private message types opaquely.
pub fn action_recipient<T>(&self) -> Box<dyn ActionRecipient<T>> where
T: Action,
A: ActionHandler<T>,
pub fn action_recipient<T>(&self) -> Box<dyn ActionRecipient<T>> where
T: Action,
A: ActionHandler<T>,
Returns an ActionRecipient
instance.
pub fn interaction_recipient<T>(&self) -> Box<dyn InteractionRecipient<T>> where
T: Interaction,
A: InteractionHandler<T>,
pub fn interaction_recipient<T>(&self) -> Box<dyn InteractionRecipient<T>> where
T: Interaction,
A: InteractionHandler<T>,
Returns an InteractionRecipient
instance.
Trait Implementations
Send an Action
to an Actor
.
impl<T, A> From<Address<A>> for Box<dyn ActionRecipient<T>> where
T: Action,
A: Actor + ActionHandler<T>,
impl<T, A> From<Address<A>> for Box<dyn ActionRecipient<T>> where
T: Action,
A: Actor + ActionHandler<T>,
impl<T, A> From<Address<A>> for Box<dyn InteractionRecipient<T>> where
T: Interaction,
A: Actor + InteractionHandler<T>,
impl<T, A> From<Address<A>> for Box<dyn InteractionRecipient<T>> where
T: Interaction,
A: Actor + InteractionHandler<T>,
impl<T, A> InteractionRecipient<T> for Address<A> where
T: Interaction,
A: Actor + ActionHandler<Interact<T>>,
impl<T, A> InteractionRecipient<T> for Address<A> where
T: Interaction,
A: Actor + ActionHandler<Interact<T>>,
Auto Trait Implementations
impl<A> !RefUnwindSafe for Address<A>
impl<A> !UnwindSafe for Address<A>
Blanket Implementations
Mutably borrows from an owned value. Read more