Struct meio::Address [−][src]
pub struct Address<A: Actor> { /* fields omitted */ }
Address
to send messages to Actor
.
Can be compared each other to identify senders to
the same Actor
.
Implementations
impl<A: Actor> Address<A>
[src]
impl<A: Actor> Address<A>
[src]pub async fn act<I>(&mut self, input: I) -> Result<(), Error> where
I: Action,
A: ActionHandler<I>,
[src]
pub async fn act<I>(&mut self, input: I) -> Result<(), Error> where
I: Action,
A: ActionHandler<I>,
[src]Just sends an Action
to the Actor
.
pub fn instant<I>(&self, input: I) -> Result<(), Error> where
I: InstantAction,
A: InstantActionHandler<I>,
[src]
pub fn instant<I>(&self, input: I) -> Result<(), Error> where
I: InstantAction,
A: InstantActionHandler<I>,
[src]Just sends an Action
to the Actor
.
pub fn schedule<I>(&self, input: I, deadline: Instant) -> Result<(), Error> where
I: Send + 'static,
A: Scheduled<I>,
[src]
pub fn schedule<I>(&self, input: I, deadline: Instant) -> Result<(), Error> where
I: Send + 'static,
A: Scheduled<I>,
[src]Just sends an Action
to the Actor
.
pub fn interact<I>(&self, request: I) -> InteractionTask<I> where
I: Interaction,
A: ActionHandler<Interact<I>>,
[src]
pub fn interact<I>(&self, request: I) -> InteractionTask<I> where
I: Interaction,
A: ActionHandler<Interact<I>>,
[src]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
.
pub async fn join(self)
[src]
pub async fn join(self)
[src]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.
pub fn attach<S, M>(&mut self, stream: S, tag: M) -> Result<(), Error> where
A: Consumer<S::Item> + StreamAcceptor<S::Item>,
S: Stream + Send + Unpin + 'static,
S::Item: Send + 'static,
M: Tag,
[src]
pub fn attach<S, M>(&mut self, stream: S, tag: M) -> Result<(), Error> where
A: Consumer<S::Item> + StreamAcceptor<S::Item>,
S: Stream + Send + Unpin + 'static,
S::Item: Send + 'static,
M: Tag,
[src]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.
pub fn link<T>(&self) -> T where
T: From<Self>,
[src]
pub fn link<T>(&self) -> T where
T: From<Self>,
[src]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>,
[src]
pub fn action_recipient<T>(&self) -> Box<dyn ActionRecipient<T>> where
T: Action,
A: ActionHandler<T>,
[src]Returns an ActionRecipient
instance.
pub fn interaction_recipient<T>(&self) -> Box<dyn InteractionRecipient<T>> where
T: Interaction,
A: InteractionHandler<T>,
[src]
pub fn interaction_recipient<T>(&self) -> Box<dyn InteractionRecipient<T>> where
T: Interaction,
A: InteractionHandler<T>,
[src]Returns an InteractionRecipient
instance.
Trait Implementations
impl<T, A> ActionRecipient<T> for Address<A> where
T: Action,
A: Actor + ActionHandler<T>,
[src]
impl<T, A> ActionRecipient<T> for Address<A> where
T: Action,
A: Actor + ActionHandler<T>,
[src]fn act<'life0, 'async_trait>(
&'life0 mut self,
msg: T
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
fn act<'life0, 'async_trait>(
&'life0 mut self,
msg: T
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]Send an Action
to an Actor
.
fn id_ref(&self) -> &Id
[src]
fn dyn_clone(&self) -> Box<dyn ActionRecipient<T>>
[src]
fn dyn_hash(&self, state: &mut dyn Hasher)
[src]
impl<T, A> InteractionRecipient<T> for Address<A> where
T: Interaction,
A: Actor + ActionHandler<Interact<T>>,
[src]
impl<T, A> InteractionRecipient<T> for Address<A> where
T: Interaction,
A: Actor + ActionHandler<Interact<T>>,
[src]impl<T, A> Into<Box<dyn ActionRecipient<T> + 'static, Global>> for Address<A> where
T: Action,
A: Actor + ActionHandler<T>,
[src]
impl<T, A> Into<Box<dyn ActionRecipient<T> + 'static, Global>> for Address<A> where
T: Action,
A: Actor + ActionHandler<T>,
[src]fn into(self) -> Box<dyn ActionRecipient<T>>
[src]
fn into(self) -> Box<dyn ActionRecipient<T>>
[src]Performs the conversion.
impl<T, A> Into<Box<dyn InteractionRecipient<T> + 'static, Global>> for Address<A> where
T: Interaction,
A: Actor + InteractionHandler<T>,
[src]
impl<T, A> Into<Box<dyn InteractionRecipient<T> + 'static, Global>> for Address<A> where
T: Interaction,
A: Actor + InteractionHandler<T>,
[src]fn into(self) -> Box<dyn InteractionRecipient<T>>
[src]
fn into(self) -> Box<dyn InteractionRecipient<T>>
[src]Performs the conversion.
impl<A: Actor> Eq for Address<A>
[src]
Auto Trait Implementations
impl<A> !RefUnwindSafe for Address<A>
impl<A> Send for Address<A>
impl<A> Sync for Address<A>
impl<A> Unpin for Address<A>
impl<A> !UnwindSafe for Address<A>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more