Struct tonari_actor::Recipient
source · pub struct Recipient<M> { /* private fields */ }
Expand description
Similar to Addr
, but rather than pointing to a specific actor,
it is typed for any actor that handles a given message-response type.
Implementations§
source§impl<M: 'static> Recipient<M>
impl<M: 'static> Recipient<M>
sourcepub fn recipient<N: Into<M>>(&self) -> Recipient<N>
pub fn recipient<N: Into<M>>(&self) -> Recipient<N>
Convert a Recipient<M>
(or Addr<A>
through Deref
, where A::Message = M
) into
Recipient<N>
, where message N
can be converted into M
.
In case of converting from Addr
, this erases the type of the actor and only preserves
type of the message, allowing you to make actors more independent of each other.
Trait Implementations§
source§impl<M> RecipientExt<M> for Recipient<TimedMessage<M>>
impl<M> RecipientExt<M> for Recipient<TimedMessage<M>>
source§fn send_now(&self, message: M) -> Result<(), SendError>
fn send_now(&self, message: M) -> Result<(), SendError>
Send a
message
now. Convenience to wrap message in TimedMessage::Instant
.source§fn send_timed(&self, message: M, fire_at: Instant) -> Result<(), SendError>
fn send_timed(&self, message: M, fire_at: Instant) -> Result<(), SendError>
Send a
message
to be delivered later at a certain instant.