pub enum EitherOutput<A, B> {
A(A),
B(B),
}
Variants§
Trait Implementations§
Source§impl<A, B> AsyncRead for EitherOutput<A, B>
impl<A, B> AsyncRead for EitherOutput<A, B>
Source§impl<A, B> AsyncWrite for EitherOutput<A, B>where
A: AsyncWrite,
B: AsyncWrite,
impl<A, B> AsyncWrite for EitherOutput<A, B>where
A: AsyncWrite,
B: AsyncWrite,
Source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize, Error>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize, Error>>
Attempt to write bytes from
buf
into the object. Read moreSource§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>],
) -> Poll<Result<usize, Error>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>], ) -> Poll<Result<usize, Error>>
Attempt to write bytes from
bufs
into the object using vectored
IO operations. Read moreSource§impl<A: Clone, B: Clone> Clone for EitherOutput<A, B>
impl<A: Clone, B: Clone> Clone for EitherOutput<A, B>
Source§fn clone(&self) -> EitherOutput<A, B>
fn clone(&self) -> EitherOutput<A, B>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<A, B> ConnectionInfo for EitherOutput<A, B>where
A: ConnectionInfo,
B: ConnectionInfo,
impl<A, B> ConnectionInfo for EitherOutput<A, B>where
A: ConnectionInfo,
B: ConnectionInfo,
fn local_multiaddr(&self) -> Multiaddr
fn remote_multiaddr(&self) -> Multiaddr
Source§impl<A, B> SecureInfo for EitherOutput<A, B>where
A: SecureInfo,
B: SecureInfo,
impl<A, B> SecureInfo for EitherOutput<A, B>where
A: SecureInfo,
B: SecureInfo,
fn local_peer(&self) -> PeerId
fn remote_peer(&self) -> PeerId
fn local_priv_key(&self) -> Keypair
fn remote_pub_key(&self) -> PublicKey
Source§impl<A, B> StreamInfo for EitherOutput<A, B>where
A: StreamInfo,
B: StreamInfo,
impl<A, B> StreamInfo for EitherOutput<A, B>where
A: StreamInfo,
B: StreamInfo,
Source§impl<A, B> StreamMuxer for EitherOutput<A, B>
impl<A, B> StreamMuxer for EitherOutput<A, B>
Source§fn open_stream<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<IReadWrite, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn open_stream<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<IReadWrite, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Opens a new outgoing substream.
Source§fn accept_stream<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<IReadWrite, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn accept_stream<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<IReadWrite, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Accepts a new incoming substream.
Source§fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Closes the stream muxer, the runtime of stream muxer will then exit.
Source§fn task(&mut self) -> Option<BoxFuture<'static, ()>>
fn task(&mut self) -> Option<BoxFuture<'static, ()>>
Returns a Future which represents the main loop of the stream muxer.
Source§fn box_clone(&self) -> IStreamMuxer
fn box_clone(&self) -> IStreamMuxer
Returns the cloned Trait object.
impl<A: Copy, B: Copy> Copy for EitherOutput<A, B>
impl<A, B> StreamMuxerEx for EitherOutput<A, B>where
A: StreamMuxer + ConnectionInfo + SecureInfo + Debug,
B: StreamMuxer + ConnectionInfo + SecureInfo + Debug,
impl<'pin, A, B> Unpin for EitherOutput<A, B>where
__EitherOutput<'pin, A, B>: Unpin,
impl<A, B> UnsafeUnpin for EitherOutput<A, B>
Auto Trait Implementations§
impl<A, B> Freeze for EitherOutput<A, B>
impl<A, B> RefUnwindSafe for EitherOutput<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for EitherOutput<A, B>
impl<A, B> Sync for EitherOutput<A, B>
impl<A, B> UnwindSafe for EitherOutput<A, B>where
A: UnwindSafe,
B: UnwindSafe,
Blanket Implementations§
Source§impl<R> AsyncReadExt for R
impl<R> AsyncReadExt for R
Source§fn chain<R>(self, next: R) -> Chain<Self, R>
fn chain<R>(self, next: R) -> Chain<Self, R>
Creates an adaptor which will chain this stream with another. Read more
Source§fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>where
Self: Unpin,
fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>where
Self: Unpin,
Tries to read some bytes directly into the given
buf
in asynchronous
manner, returning a future type. Read moreSource§fn read_vectored<'a>(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>],
) -> ReadVectored<'a, Self>where
Self: Unpin,
fn read_vectored<'a>(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>],
) -> ReadVectored<'a, Self>where
Self: Unpin,
Creates a future which will read from the
AsyncRead
into bufs
using vectored
IO operations. Read moreSource§fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>where
Self: Unpin,
fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>where
Self: Unpin,
Creates a future which will read exactly enough bytes to fill
buf
,
returning an error if end of file (EOF) is hit sooner. Read moreSource§fn read_to_end<'a>(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self>where
Self: Unpin,
fn read_to_end<'a>(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self>where
Self: Unpin,
Creates a future which will read all the bytes from this
AsyncRead
. Read moreSource§fn read_to_string<'a>(
&'a mut self,
buf: &'a mut String,
) -> ReadToString<'a, Self>where
Self: Unpin,
fn read_to_string<'a>(
&'a mut self,
buf: &'a mut String,
) -> ReadToString<'a, Self>where
Self: Unpin,
Creates a future which will read all the bytes from this
AsyncRead
. Read moreSource§impl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
impl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
Source§fn flush(&mut self) -> Flush<'_, Self>where
Self: Unpin,
fn flush(&mut self) -> Flush<'_, Self>where
Self: Unpin,
Creates a future which will entirely flush this
AsyncWrite
. Read moreSource§fn close(&mut self) -> Close<'_, Self>where
Self: Unpin,
fn close(&mut self) -> Close<'_, Self>where
Self: Unpin,
Creates a future which will entirely close this
AsyncWrite
.Source§fn write<'a>(&'a mut self, buf: &'a [u8]) -> Write<'a, Self>where
Self: Unpin,
fn write<'a>(&'a mut self, buf: &'a [u8]) -> Write<'a, Self>where
Self: Unpin,
Creates a future which will write bytes from
buf
into the object. Read moreSource§fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>],
) -> WriteVectored<'a, Self>where
Self: Unpin,
fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>],
) -> WriteVectored<'a, Self>where
Self: Unpin,
Creates a future which will write bytes from
bufs
into the object using vectored
IO operations. Read moreSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ReadEx for T
impl<T> ReadEx for T
Source§fn read2<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buf: &'life1 mut [u8],
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
fn read2<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buf: &'life1 mut [u8],
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
Reads some bytes from the byte stream. Read more
Source§fn read_exact2<'a, 'async_trait>(
&'a mut self,
buf: &'a mut [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn read_exact2<'a, 'async_trait>(
&'a mut self,
buf: &'a mut [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Reads the exact number of bytes requested. Read more
Source§fn read_fixed_u32<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_fixed_u32<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reads a fixed-length integer from the underlying IO. Read more
Source§fn read_varint<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_varint<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reads a variable-length integer from the underlying IO. Read more
Source§impl<T> WriteEx for T
impl<T> WriteEx for T
Source§fn write2<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
fn write2<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
Attempt to write bytes from
buf
into the object. Read moreSource§fn flush2<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn flush2<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
Attempt to flush the object, ensuring that any buffered data reach
their destination. Read more
Source§fn close2<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn close2<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
Attempt to close the object. Read more
Source§fn write_all2<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_all2<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Attempt to write the entire contents of data into object. Read more
Source§fn write_varint<'life0, 'async_trait>(
&'life0 mut self,
len: usize,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn write_varint<'life0, 'async_trait>(
&'life0 mut self,
len: usize,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Writes a variable-length integer to the underlying IO. Read more
Source§fn write_fixed_u32<'life0, 'async_trait>(
&'life0 mut self,
len: usize,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn write_fixed_u32<'life0, 'async_trait>(
&'life0 mut self,
len: usize,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Writes a fixed-length integer to the underlying IO. Read more
Source§fn write_one_fixed<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_one_fixed<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a fixed length message to the underlying IO, then flushes the writing side. Read more
Source§fn write_one<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_one<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a variable length message to the underlying IO, then flushes the writing side. Read more