Struct libp2p_yamux::Yamux
source · [−]pub struct Yamux<S>(_);
Expand description
A Yamux connection.
Trait Implementations
sourceimpl<S> StreamMuxer for Yamux<S> where
S: Stream<Item = Result<Stream, YamuxError>> + Unpin,
impl<S> StreamMuxer for Yamux<S> where
S: Stream<Item = Result<Stream, YamuxError>> + Unpin,
Note: This implementation never emits
StreamMuxerEvent::AddressChange
events.
type Substream = Stream
type Substream = Stream
Type of the object that represents the raw substream where data can be read and written.
type OutboundSubstream = OpenSubstreamToken
type OutboundSubstream = OpenSubstreamToken
Future that will be resolved when the outgoing substream is open.
type Error = YamuxError
type Error = YamuxError
Error type of the muxer
sourcefn poll_event(
&self,
c: &mut Context<'_>
) -> Poll<YamuxResult<StreamMuxerEvent<Self::Substream>>>
fn poll_event(
&self,
c: &mut Context<'_>
) -> Poll<YamuxResult<StreamMuxerEvent<Self::Substream>>>
Polls for a connection-wide event. Read more
sourcefn open_outbound(&self) -> Self::OutboundSubstream
fn open_outbound(&self) -> Self::OutboundSubstream
Opens a new outgoing substream, and produces the equivalent to a future that will be resolved when it becomes available. Read more
sourcefn poll_outbound(
&self,
c: &mut Context<'_>,
_: &mut OpenSubstreamToken
) -> Poll<YamuxResult<Self::Substream>>
fn poll_outbound(
&self,
c: &mut Context<'_>,
_: &mut OpenSubstreamToken
) -> Poll<YamuxResult<Self::Substream>>
Polls the outbound substream. Read more
sourcefn destroy_outbound(&self, _: Self::OutboundSubstream)
fn destroy_outbound(&self, _: Self::OutboundSubstream)
Destroys an outbound substream future. Use this after the outbound substream has finished, or if you want to interrupt it. Read more
sourcefn read_substream(
&self,
c: &mut Context<'_>,
s: &mut Self::Substream,
b: &mut [u8]
) -> Poll<YamuxResult<usize>>
fn read_substream(
&self,
c: &mut Context<'_>,
s: &mut Self::Substream,
b: &mut [u8]
) -> Poll<YamuxResult<usize>>
Reads data from a substream. The behaviour is the same as futures::AsyncRead::poll_read
. Read more
sourcefn write_substream(
&self,
c: &mut Context<'_>,
s: &mut Self::Substream,
b: &[u8]
) -> Poll<YamuxResult<usize>>
fn write_substream(
&self,
c: &mut Context<'_>,
s: &mut Self::Substream,
b: &[u8]
) -> Poll<YamuxResult<usize>>
Write data to a substream. The behaviour is the same as futures::AsyncWrite::poll_write
. Read more
sourcefn flush_substream(
&self,
c: &mut Context<'_>,
s: &mut Self::Substream
) -> Poll<YamuxResult<()>>
fn flush_substream(
&self,
c: &mut Context<'_>,
s: &mut Self::Substream
) -> Poll<YamuxResult<()>>
Flushes a substream. The behaviour is the same as futures::AsyncWrite::poll_flush
. Read more
sourcefn shutdown_substream(
&self,
c: &mut Context<'_>,
s: &mut Self::Substream
) -> Poll<YamuxResult<()>>
fn shutdown_substream(
&self,
c: &mut Context<'_>,
s: &mut Self::Substream
) -> Poll<YamuxResult<()>>
Attempts to shut down the writing side of a substream. The behaviour is similar to
AsyncWrite::poll_close
. Read more
sourcefn destroy_substream(&self, _: Self::Substream)
fn destroy_substream(&self, _: Self::Substream)
Destroys a substream.
sourcefn close(&self, c: &mut Context<'_>) -> Poll<YamuxResult<()>>
fn close(&self, c: &mut Context<'_>) -> Poll<YamuxResult<()>>
Closes this StreamMuxer
. Read more
sourcefn flush_all(&self, _: &mut Context<'_>) -> Poll<YamuxResult<()>>
fn flush_all(&self, _: &mut Context<'_>) -> Poll<YamuxResult<()>>
Flush this StreamMuxer
. Read more
sourcefn is_remote_acknowledged(&self) -> bool
fn is_remote_acknowledged(&self) -> bool
This method is unused and will be removed in the future
Returns true
if the remote has shown any sign of activity after the muxer has been open. Read more
Auto Trait Implementations
impl<S> !RefUnwindSafe for Yamux<S>
impl<S> Send for Yamux<S> where
S: Send,
impl<S> Sync for Yamux<S> where
S: Send,
impl<S> Unpin for Yamux<S> where
S: Unpin,
impl<S> !UnwindSafe for Yamux<S>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more