pub struct TimedContext<M>(/* private fields */);Expand description
A Context variant available to actors wrapped by the Timed actor wrapper.
Wraps and dereferences to BareContext with the message wrapped in TimedMessage.
Implementations§
Source§impl<M: 'static> TimedContext<M>
impl<M: 'static> TimedContext<M>
Sourcepub fn subscribe<E: Event + Into<M>>(&self)
pub fn subscribe<E: Event + Into<M>>(&self)
Subscribe current actor to event of type E. Events will be delivered as instant messages.
A variant of BareContext::subscribe() that performs one extra message conversion:
E -> M -> TimedMessage<M>.
Sourcepub fn subscribe_and_receive_latest<E: Event + Into<M>>(
&self,
) -> Result<(), SendError>
pub fn subscribe_and_receive_latest<E: Event + Into<M>>( &self, ) -> Result<(), SendError>
Subscribe current actor to event of type E and send the last cached event to it.
Events will be delivered as instant messages.
A variant of BareContext::subscribe_and_receive_latest() that performs one extra message
conversion: E -> M -> TimedMessage<M>.
Methods from Deref<Target = BareContext<TimedMessage<M>>>§
Sourcepub fn subscribe<E: Event + Into<M>>(&self)
pub fn subscribe<E: Event + Into<M>>(&self)
Subscribe current actor to event of type E. This is part of the event system. You don’t
need to call this method to receive direct messages sent using Addr and Recipient.
Note that subscribing twice to the same event would result in duplicate events – no de-duplication of subscriptions is performed.
Sourcepub fn subscribe_and_receive_latest<E: Event + Into<M>>(
&self,
) -> Result<(), SendError>
pub fn subscribe_and_receive_latest<E: Event + Into<M>>( &self, ) -> Result<(), SendError>
Subscribe current actor to event of type E and send the last cached event to it.
This is part of the event system. You don’t need to call this method to receive
direct messages sent using Addr and Recipient.
Note that subscribing twice to the same event would result in duplicate events – no de-duplication of subscriptions is performed.
This method may fail if it is not possible to send the latest event. In this case it is guaranteed that the subscription did not take place. You can safely try again.