pub struct MessageContext {
pub frame: Frame,
pub connection_id: Option<String>,
pub parser: MessageParser,
pub metadata: Arc<RwLock<HashMap<String, Vec<u8>>>>,
}Expand description
消息处理上下文
包含消息处理所需的所有上下文信息
Fields§
§frame: Frame原始 Frame
connection_id: Option<String>连接 ID(服务端)或 None(客户端)
parser: MessageParser消息解析器(用于序列化/压缩)
metadata: Arc<RwLock<HashMap<String, Vec<u8>>>>元数据(用于中间件传递数据)
Implementations§
Trait Implementations§
Source§impl Clone for MessageContext
impl Clone for MessageContext
Source§fn clone(&self) -> MessageContext
fn clone(&self) -> MessageContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 !RefUnwindSafe for MessageContext
impl !UnwindSafe for MessageContext
impl Freeze for MessageContext
impl Send for MessageContext
impl Sync for MessageContext
impl Unpin for MessageContext
impl UnsafeUnpin for MessageContext
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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