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
sourcepub fn poll_event(
&self,
c: &mut Context<'_>
) -> Poll<Result<StreamMuxerEvent<<Yamux<S> as StreamMuxer>::Substream>, YamuxError>>
pub fn poll_event(
&self,
c: &mut Context<'_>
) -> Poll<Result<StreamMuxerEvent<<Yamux<S> as StreamMuxer>::Substream>, YamuxError>>
Polls for a connection-wide event. Read more
sourcepub fn open_outbound(&self) -> <Yamux<S> as StreamMuxer>::OutboundSubstream
pub fn open_outbound(&self) -> <Yamux<S> as StreamMuxer>::OutboundSubstream
Opens a new outgoing substream, and produces the equivalent to a future that will be resolved when it becomes available. Read more
sourcepub fn poll_outbound(
&self,
c: &mut Context<'_>,
&mut OpenSubstreamToken
) -> Poll<Result<<Yamux<S> as StreamMuxer>::Substream, YamuxError>>
pub fn poll_outbound(
&self,
c: &mut Context<'_>,
&mut OpenSubstreamToken
) -> Poll<Result<<Yamux<S> as StreamMuxer>::Substream, YamuxError>>
Polls the outbound substream. Read more
sourcepub fn destroy_outbound(&self, <Yamux<S> as StreamMuxer>::OutboundSubstream)
pub fn destroy_outbound(&self, <Yamux<S> as StreamMuxer>::OutboundSubstream)
Destroys an outbound substream future. Use this after the outbound substream has finished, or if you want to interrupt it. Read more
sourcepub fn read_substream(
&self,
c: &mut Context<'_>,
s: &mut <Yamux<S> as StreamMuxer>::Substream,
b: &mut [u8]
) -> Poll<Result<usize, YamuxError>>
pub fn read_substream(
&self,
c: &mut Context<'_>,
s: &mut <Yamux<S> as StreamMuxer>::Substream,
b: &mut [u8]
) -> Poll<Result<usize, YamuxError>>
Reads data from a substream. The behaviour is the same as futures::AsyncRead::poll_read
. Read more
sourcepub fn write_substream(
&self,
c: &mut Context<'_>,
s: &mut <Yamux<S> as StreamMuxer>::Substream,
b: &[u8]
) -> Poll<Result<usize, YamuxError>>
pub fn write_substream(
&self,
c: &mut Context<'_>,
s: &mut <Yamux<S> as StreamMuxer>::Substream,
b: &[u8]
) -> Poll<Result<usize, YamuxError>>
Write data to a substream. The behaviour is the same as futures::AsyncWrite::poll_write
. Read more
sourcepub fn flush_substream(
&self,
c: &mut Context<'_>,
s: &mut <Yamux<S> as StreamMuxer>::Substream
) -> Poll<Result<(), YamuxError>>
pub fn flush_substream(
&self,
c: &mut Context<'_>,
s: &mut <Yamux<S> as StreamMuxer>::Substream
) -> Poll<Result<(), YamuxError>>
Flushes a substream. The behaviour is the same as futures::AsyncWrite::poll_flush
. Read more
sourcepub fn shutdown_substream(
&self,
c: &mut Context<'_>,
s: &mut <Yamux<S> as StreamMuxer>::Substream
) -> Poll<Result<(), YamuxError>>
pub fn shutdown_substream(
&self,
c: &mut Context<'_>,
s: &mut <Yamux<S> as StreamMuxer>::Substream
) -> Poll<Result<(), YamuxError>>
Attempts to shut down the writing side of a substream. The behaviour is similar to
AsyncWrite::poll_close
. Read more
sourcepub fn destroy_substream(&self, <Yamux<S> as StreamMuxer>::Substream)
pub fn destroy_substream(&self, <Yamux<S> as StreamMuxer>::Substream)
Destroys a substream.
sourcepub fn close(&self, c: &mut Context<'_>) -> Poll<Result<(), YamuxError>>
pub fn close(&self, c: &mut Context<'_>) -> Poll<Result<(), YamuxError>>
Closes this StreamMuxer
. Read more
sourcepub fn flush_all(&self, &mut Context<'_>) -> Poll<Result<(), YamuxError>>
pub fn flush_all(&self, &mut Context<'_>) -> Poll<Result<(), YamuxError>>
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