Struct agner_actors::Context
source · [−]pub struct Context<M> { /* private fields */ }Expand description
Actor’s API to itself
Implementations
sourceimpl<M> Context<M>
impl<M> Context<M>
sourcepub async fn next_event(&mut self) -> Event<M>where
M: Unpin,
pub async fn next_event(&mut self) -> Event<M>where
M: Unpin,
Receive next event (message or signal)
sourcepub async fn next_message(&mut self) -> Mwhere
M: Unpin,
pub async fn next_message(&mut self) -> Mwhere
M: Unpin,
Receive next message.
sourcepub async fn next_signal(&mut self) -> Signal
pub async fn next_signal(&mut self) -> Signal
Receive next signal.
sourceimpl<M> Context<M>
impl<M> Context<M>
“data-bag” related methods
pub fn put<D>(&mut self, data: D) -> Option<D>where
D: Any + Send + Sync + 'static,
pub fn take<D>(&mut self) -> Option<D>where
D: Any + Send + Sync + 'static,
pub fn get<D>(&self) -> Option<&D>where
D: Any + Send + Sync + 'static,
pub fn get_mut<D>(&mut self) -> Option<&mut D>where
D: Any + Send + Sync + 'static,
pub fn with_data(
self,
data: HashMap<TypeId, Box<dyn Any + Send + Sync + 'static>>
) -> Self
Trait Implementations
Auto Trait Implementations
impl<M> !RefUnwindSafe for Context<M>
impl<M> Send for Context<M>where
M: Send,
impl<M> Sync for Context<M>where
M: Send,
impl<M> Unpin for Context<M>
impl<M> !UnwindSafe for Context<M>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more