pub struct Context<Actor, Message, State, Response, Error> {
pub mgs: Message,
pub state: Arc<Mutex<State>>,
pub self_ref: Arc<ActorRef<Actor, Message, State, Response, Error>>,
}Expand description
Context is a structure that represents the context in which an actor operates in an actor system.
It contains the necessary components for an actor to process a message and manage its state.
§Type Parameters
Actor: The type of the actor this context is associated with.Message: The type of messages that can be processed in this context.State: The type of the state that the actor maintains.Response: The type of the response that the actor produces.Error: The type of the error that the actor can return.
§Fields
mgs: The message that the actor needs to process.state: An atomic reference counter (Arc) wrapping a mutex-protected state of the actor.self_ref: A reference to the actor itself.
Fields§
§mgs: Message§state: Arc<Mutex<State>>§self_ref: Arc<ActorRef<Actor, Message, State, Response, Error>>Trait Implementations§
Auto Trait Implementations§
impl<Actor, Message, State, Response, Error> Freeze for Context<Actor, Message, State, Response, Error>where
Message: Freeze,
impl<Actor, Message, State, Response, Error> !RefUnwindSafe for Context<Actor, Message, State, Response, Error>
impl<Actor, Message, State, Response, Error> Send for Context<Actor, Message, State, Response, Error>
impl<Actor, Message, State, Response, Error> Sync for Context<Actor, Message, State, Response, Error>
impl<Actor, Message, State, Response, Error> Unpin for Context<Actor, Message, State, Response, Error>where
Message: Unpin,
impl<Actor, Message, State, Response, Error> !UnwindSafe for Context<Actor, Message, State, Response, Error>
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