pub struct DefaultServerMessageObserverFactory { /* private fields */ }Expand description
默认观察者工厂
使用 DefaultServerMessageObserver 创建观察者
§使用示例
ⓘ
use flare_core::server::events::factory::DefaultServerMessageObserverFactory;
// 使用默认工厂
let factory = DefaultServerMessageObserverFactory::new();
// 或配置设备管理器和事件处理器
let factory = DefaultServerMessageObserverFactory::new()
.with_device_manager(Some(device_manager))
.with_event_handler(Some(event_handler));Implementations§
Source§impl DefaultServerMessageObserverFactory
impl DefaultServerMessageObserverFactory
Sourcepub fn with_device_manager(
self,
device_manager: Option<Arc<DeviceManager>>,
) -> Self
pub fn with_device_manager( self, device_manager: Option<Arc<DeviceManager>>, ) -> Self
设置设备管理器
Sourcepub fn with_event_handler(
self,
event_handler: Option<Arc<dyn ServerEventHandler>>,
) -> Self
pub fn with_event_handler( self, event_handler: Option<Arc<dyn ServerEventHandler>>, ) -> Self
设置事件处理器
Trait Implementations§
Source§impl ServerMessageObserverFactory for DefaultServerMessageObserverFactory
服务端观察者工厂实现
impl ServerMessageObserverFactory for DefaultServerMessageObserverFactory
服务端观察者工厂实现
Source§fn create_observer(
&self,
manager: Arc<ConnectionManager>,
parser: MessageParser,
event_handler: Arc<dyn ServerEventHandler>,
connection_id: String,
core_ref: Arc<ServerCoreRef>,
_core: Arc<ServerCore>,
) -> Arc<dyn ConnectionObserver> ⓘ
fn create_observer( &self, manager: Arc<ConnectionManager>, parser: MessageParser, event_handler: Arc<dyn ServerEventHandler>, connection_id: String, core_ref: Arc<ServerCoreRef>, _core: Arc<ServerCore>, ) -> Arc<dyn ConnectionObserver> ⓘ
为指定连接创建观察者 Read more
Auto Trait Implementations§
impl !RefUnwindSafe for DefaultServerMessageObserverFactory
impl !UnwindSafe for DefaultServerMessageObserverFactory
impl Freeze for DefaultServerMessageObserverFactory
impl Send for DefaultServerMessageObserverFactory
impl Sync for DefaultServerMessageObserverFactory
impl Unpin for DefaultServerMessageObserverFactory
impl UnsafeUnpin for DefaultServerMessageObserverFactory
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