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.Auto Trait Implementations§
impl<M> Freeze for Recipient<M>
impl<M> !RefUnwindSafe for Recipient<M>
impl<M> Send for Recipient<M>
impl<M> Sync for Recipient<M>
impl<M> Unpin for Recipient<M>
impl<M> !UnwindSafe for Recipient<M>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)