pub struct ServerMessageWrapper { /* private fields */ }Expand description
服务端事件包装器
将 DefaultServerMessageObserver 的功能直接集成到 ConnectionHandler 中,
提供统一的消息和连接事件处理
Implementations§
Source§impl ServerMessageWrapper
impl ServerMessageWrapper
Sourcepub fn new(
event_handler: Arc<dyn ServerEventHandler>,
connection_manager: Option<Arc<ConnectionManager>>,
device_manager: Option<Arc<DeviceManager>>,
parser: MessageParser,
) -> Self
pub fn new( event_handler: Arc<dyn ServerEventHandler>, connection_manager: Option<Arc<ConnectionManager>>, device_manager: Option<Arc<DeviceManager>>, parser: MessageParser, ) -> Self
创建新的服务端消息包装器
§参数
event_handler: 事件处理器,用于处理所有事件和消息connection_manager: 连接管理器(可选,用于发送响应)device_manager: 设备管理器(可选,用于设备管理)parser: 消息解析器(用于序列化响应)
Trait Implementations§
Source§impl Clone for ServerMessageWrapper
impl Clone for ServerMessageWrapper
Source§impl ConnectionHandler for ServerMessageWrapper
实现连接处理的接口
impl ConnectionHandler for ServerMessageWrapper
实现连接处理的接口
Source§fn handle_frame<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
frame: &'life1 Frame,
connection_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Frame>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn handle_frame<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
frame: &'life1 Frame,
connection_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Frame>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
处理消息
Auto Trait Implementations§
impl !RefUnwindSafe for ServerMessageWrapper
impl !UnwindSafe for ServerMessageWrapper
impl Freeze for ServerMessageWrapper
impl Send for ServerMessageWrapper
impl Sync for ServerMessageWrapper
impl Unpin for ServerMessageWrapper
impl UnsafeUnpin for ServerMessageWrapper
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