pub struct HandlerContext { /* private fields */ }Expand description
Context provided to message handlers.
Implementations§
Source§impl HandlerContext
impl HandlerContext
Sourcepub fn from_message(agent_id: AgentId, message: Message) -> Self
pub fn from_message(agent_id: AgentId, message: Message) -> Self
Constructs a context from an owned message.
Constructs a context from a shared message instance.
Sourcepub fn received_at(&self) -> Instant
pub fn received_at(&self) -> Instant
Returns the time the message was received.
Sourcepub fn message_type(&self) -> HandlerResult<MessageType>
pub fn message_type(&self) -> HandlerResult<MessageType>
Returns the MXP message type.
§Errors
Returns HandlerError::MissingMessageType when the header could not be
decoded into a MessageType.
Trait Implementations§
Source§impl Clone for HandlerContext
impl Clone for HandlerContext
Source§fn clone(&self) -> HandlerContext
fn clone(&self) -> HandlerContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HandlerContext
impl RefUnwindSafe for HandlerContext
impl Send for HandlerContext
impl Sync for HandlerContext
impl Unpin for HandlerContext
impl UnwindSafe for HandlerContext
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