pub trait DisconnectHandler<A: Adapter, T>:
Send
+ Sync
+ 'static {
// Required method
fn call_with_defer(
&self,
s: Arc<Socket<A>>,
reason: DisconnectReason,
defer: fn(Arc<Socket<A>>),
);
// Provided method
fn call(&self, s: Arc<Socket<A>>, reason: DisconnectReason) { ... }
}Expand description
Define a handler for the disconnect event.
It is implemented for closures with up to 16 arguments. They must implement the FromDisconnectParts trait.
- See the
disconnectmodule doc for more details on disconnect handler. - See the
extractmodule doc for more details on available extractors.
Required Methods§
Sourcefn call_with_defer(
&self,
s: Arc<Socket<A>>,
reason: DisconnectReason,
defer: fn(Arc<Socket<A>>),
)
fn call_with_defer( &self, s: Arc<Socket<A>>, reason: DisconnectReason, defer: fn(Arc<Socket<A>>), )
Call the handler and issue a deferred function that will be executed after the disconnect handler
Provided Methods§
Sourcefn call(&self, s: Arc<Socket<A>>, reason: DisconnectReason)
fn call(&self, s: Arc<Socket<A>>, reason: DisconnectReason)
Call the handler with the given arguments.