pub trait CanDisconnect<T>: Sink<T> + Unpin {
// Required method
fn disconnect(
&mut self,
reason: DisconnectReason,
) -> impl Future<Output = Result<(), <Self as Sink<T>>::Error>> + Send;
}
Expand description
This trait is meant to allow higher level protocols like eth
to disconnect from a peer, using
lower-level disconnect functions (such as those that exist in the p2p
protocol) if the
underlying stream supports it.
Required Methods§
Sourcefn disconnect(
&mut self,
reason: DisconnectReason,
) -> impl Future<Output = Result<(), <Self as Sink<T>>::Error>> + Send
fn disconnect( &mut self, reason: DisconnectReason, ) -> impl Future<Output = Result<(), <Self as Sink<T>>::Error>> + Send
Disconnects from the underlying stream, using a DisconnectReason
as disconnect
information if the stream implements a protocol that can carry the additional disconnect
metadata.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.