pub struct Context<A: Actor> { /* private fields */ }Expand description
Context passed to each handler
Implementations§
Source§impl<A: Actor> Context<A>
impl<A: Actor> Context<A>
pub fn new( address: WeakAddress<A>, private_address: UnboundedAddress<A>, state: ActorState, ) -> Context<A>
Sourcepub fn address(&self) -> WeakAddress<A>
pub fn address(&self) -> WeakAddress<A>
Public address
Be aware that actor will not be dropped until explicitly stopped or at least one Address clone remains. Prefer to hold downgraded WeakAddress version and upgrade it when needed if possible.
Sourcepub fn private_address(&self) -> UnboundedAddress<A>
pub fn private_address(&self) -> UnboundedAddress<A>
Private address, prioritized and unbound.
Should be used only by the current actor and other actors controlled by it.
Unlike the main address holding private address doesn’t prevent actor from stopping if all public addresses are dropped.
Auto Trait Implementations§
impl<A> Freeze for Context<A>
impl<A> RefUnwindSafe for Context<A>
impl<A> Send for Context<A>
impl<A> Sync for Context<A>
impl<A> Unpin for Context<A>
impl<A> UnwindSafe for Context<A>
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