Struct libp2p::core::muxing::SingletonMuxer
source · pub struct SingletonMuxer<TSocket> { /* private fields */ }
Expand description
Implementation of StreamMuxer
that allows only one substream on top of a connection,
yielding the connection itself.
Applying this muxer on a connection doesn’t read or write any data on the connection itself. Most notably, no protocol is negotiated.
Implementations§
source§impl<TSocket> SingletonMuxer<TSocket>
impl<TSocket> SingletonMuxer<TSocket>
sourcepub fn new(inner: TSocket, endpoint: Endpoint) -> SingletonMuxer<TSocket>
pub fn new(inner: TSocket, endpoint: Endpoint) -> SingletonMuxer<TSocket>
Creates a new SingletonMuxer
.
If endpoint
is Dialer
, then only one outbound substream will be permitted.
If endpoint
is Listener
, then only one inbound substream will be permitted.
Trait Implementations§
source§impl<TSocket> StreamMuxer for SingletonMuxer<TSocket>where
TSocket: AsyncRead + AsyncWrite + Unpin,
impl<TSocket> StreamMuxer for SingletonMuxer<TSocket>where
TSocket: AsyncRead + AsyncWrite + Unpin,
§type Substream = TSocket
type Substream = TSocket
Type of the object that represents the raw substream where data can be read and written.
source§fn poll_inbound(
self: Pin<&mut SingletonMuxer<TSocket>>,
_: &mut Context<'_>
) -> Poll<Result<<SingletonMuxer<TSocket> as StreamMuxer>::Substream, <SingletonMuxer<TSocket> as StreamMuxer>::Error>>
fn poll_inbound(
self: Pin<&mut SingletonMuxer<TSocket>>,
_: &mut Context<'_>
) -> Poll<Result<<SingletonMuxer<TSocket> as StreamMuxer>::Substream, <SingletonMuxer<TSocket> as StreamMuxer>::Error>>
Poll for new inbound substreams. Read more
source§fn poll_outbound(
self: Pin<&mut SingletonMuxer<TSocket>>,
_: &mut Context<'_>
) -> Poll<Result<<SingletonMuxer<TSocket> as StreamMuxer>::Substream, <SingletonMuxer<TSocket> as StreamMuxer>::Error>>
fn poll_outbound(
self: Pin<&mut SingletonMuxer<TSocket>>,
_: &mut Context<'_>
) -> Poll<Result<<SingletonMuxer<TSocket> as StreamMuxer>::Substream, <SingletonMuxer<TSocket> as StreamMuxer>::Error>>
Poll for a new, outbound substream.
source§fn poll_close(
self: Pin<&mut SingletonMuxer<TSocket>>,
_cx: &mut Context<'_>
) -> Poll<Result<(), Error>>
fn poll_close(
self: Pin<&mut SingletonMuxer<TSocket>>,
_cx: &mut Context<'_>
) -> Poll<Result<(), Error>>
Poll to close this
StreamMuxer
. Read moresource§fn poll(
self: Pin<&mut SingletonMuxer<TSocket>>,
_: &mut Context<'_>
) -> Poll<Result<StreamMuxerEvent, <SingletonMuxer<TSocket> as StreamMuxer>::Error>>
fn poll(
self: Pin<&mut SingletonMuxer<TSocket>>,
_: &mut Context<'_>
) -> Poll<Result<StreamMuxerEvent, <SingletonMuxer<TSocket> as StreamMuxer>::Error>>
Poll to allow the underlying connection to make progress. Read more