Trait CanDisconnect

Source
pub trait CanDisconnect<T>: Sink<T> + Unpin {
    // Required method
    fn disconnect(
        &mut self,
        reason: DisconnectReason,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::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§

Source

fn disconnect( &mut self, reason: DisconnectReason, ) -> Pin<Box<dyn Future<Output = Result<(), Self::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.

Implementations on Foreign Types§

Source§

impl<S> CanDisconnect<Bytes> for ECIESStream<S>
where S: AsyncWrite + Unpin + Send,

Source§

fn disconnect( &mut self, _reason: DisconnectReason, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>

Source§

impl<T, I, U> CanDisconnect<I> for Framed<T, U>
where T: AsyncWrite + Unpin + Send, U: Encoder<I> + Send,

Source§

fn disconnect( &mut self, _reason: DisconnectReason, ) -> Pin<Box<dyn Future<Output = Result<(), <Self as Sink<I>>::Error>> + Send + '_>>

Implementors§

Source§

impl CanDisconnect<Bytes> for ProtocolProxy

Source§

impl<S> CanDisconnect<Bytes> for P2PStream<S>
where S: Sink<Bytes, Error = Error> + Unpin + Send + Sync,

Source§

impl<S, N> CanDisconnect<EthMessage<N>> for EthStream<S, N>
where S: CanDisconnect<Bytes> + Send, EthStreamError: From<<S as Sink<Bytes>>::Error>, N: NetworkPrimitives,