pub struct BareContext<M> {
pub system_handle: SystemHandle,
pub myself: Recipient<M>,
}Expand description
A Context without the Context::set_deadline() functionality. Used by timed and
async actors. Context dereferences to this bare variant for system_handle and myself
fields.
Fields§
§system_handle: SystemHandle§myself: Recipient<M>Implementations§
Source§impl<M: 'static> BareContext<M>
impl<M: 'static> BareContext<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.