pub struct FnHandler<F>{ /* private fields */ }Expand description
A simple function-based handler.
Implementations§
Trait Implementations§
Source§impl<F> ConnectionHandler for FnHandler<F>
impl<F> ConnectionHandler for FnHandler<F>
Source§fn on_message(
&self,
conn: &mut Connection,
msg: Message,
) -> Result<Option<Message>>
fn on_message( &self, conn: &mut Connection, msg: Message, ) -> Result<Option<Message>>
Handle a received message.
Source§fn on_connect(&self, conn: &mut Connection) -> Result<()>
fn on_connect(&self, conn: &mut Connection) -> Result<()>
Handle a new connection.
Source§fn on_disconnect(&self, conn_id: ConnectionId)
fn on_disconnect(&self, conn_id: ConnectionId)
Handle connection disconnect.
Auto Trait Implementations§
impl<F> Freeze for FnHandler<F>where
F: Freeze,
impl<F> RefUnwindSafe for FnHandler<F>where
F: RefUnwindSafe,
impl<F> Send for FnHandler<F>
impl<F> Sync for FnHandler<F>where
F: Sync,
impl<F> Unpin for FnHandler<F>where
F: Unpin,
impl<F> UnwindSafe for FnHandler<F>where
F: UnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoMetered for T
impl<T> IntoMetered for T
Source§fn metered(self, metrics: Arc<ChannelMetrics>) -> MeteredSender<Self>
fn metered(self, metrics: Arc<ChannelMetrics>) -> MeteredSender<Self>
Wrap this sender with metrics tracking.
Source§impl<T> WithMetrics for T
impl<T> WithMetrics for T
Source§fn with_metrics(self) -> MeteredWrapper<Self>
fn with_metrics(self) -> MeteredWrapper<Self>
Wrap this channel with metrics tracking.