Enum s2n_quic::stream::PeerStream
source · pub enum PeerStream {
Bidirectional(BidirectionalStream),
Receive(ReceiveStream),
}
Expand description
An enum of all the possible types of QUIC streams that may be opened by a peer.
Variants§
Bidirectional(BidirectionalStream)
Receive(ReceiveStream)
Implementations§
source§impl PeerStream
impl PeerStream
sourcepub fn id(&self) -> u64
pub fn id(&self) -> u64
Returns the stream’s identifier
This value is unique to a particular connection. The format follows the same as what is defined in the QUIC Transport RFC.
§Examples
use s2n_quic::stream::Type;
while let Some(stream) = connection.accept().await? {
println!("New stream's id: {}", stream.id());
}
sourcepub fn connection(&self) -> Handle
pub fn connection(&self) -> Handle
Returns the connection::Handle
associated with the stream.
§Examples
let connection = stream.connection();
println!("The stream's connection id is: {}", connection.id());
sourcepub async fn receive(&mut self) -> Result<Option<Bytes>>
pub async fn receive(&mut self) -> Result<Option<Bytes>>
Receives a chunk of data from the stream.
§Return value
The function returns:
Ok(Some(chunk))
if the stream is open and data was available.Ok(None)
if the stream was finished and all of the data was consumed.Err(e)
if the stream encountered astream::Error
.
§Examples
while let Some(chunk) = stream.receive().await? {
println!("received: {:?}", chunk);
}
println!("finished");
sourcepub fn poll_receive(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<Option<Bytes>>>
pub fn poll_receive( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<Option<Bytes>>>
Poll for a chunk of data from the stream.
§Return value
The function returns:
Poll::Pending
if the stream is waiting to receive data from the peer. In this case, the caller should retry receiving after theWaker
on the providedContext
is notified.Poll::Ready(Ok(Some(chunk)))
if the stream is open and data was available.Poll::Ready(Ok(None))
if the stream was finished and all of the data was consumed.Poll::Ready(Err(e))
if the stream encountered astream::Error
.
sourcepub async fn receive_vectored(
&mut self,
chunks: &mut [Bytes],
) -> Result<(usize, bool)>
pub async fn receive_vectored( &mut self, chunks: &mut [Bytes], ) -> Result<(usize, bool)>
Receives a slice of chunks of data from the stream.
This can be more efficient than calling receive
for each chunk,
especially when receiving large amounts of data.
§Return value
The function returns:
Ok((count, is_open))
if the stream received data into the slice, wherecount
was the number of chunks received, andis_open
indicating if the stream is still open. Ifis_open == true
,count
will be at least1
. Ifis_open == false
, future calls toreceive_vectored
will always returnOk((0, false))
.Err(e)
if the stream encountered astream::Error
.
§Examples
loop {
let mut chunks = [Bytes::new(), Bytes::new(), Bytes::new()];
let (count, is_open) = stream.receive_vectored(&mut chunks).await?;
for chunk in &chunks[..count] {
println!("received: {:?}", chunk);
}
if !is_open {
break;
}
}
println!("finished");
sourcepub fn poll_receive_vectored(
&mut self,
chunks: &mut [Bytes],
cx: &mut Context<'_>,
) -> Poll<Result<(usize, bool)>>
pub fn poll_receive_vectored( &mut self, chunks: &mut [Bytes], cx: &mut Context<'_>, ) -> Poll<Result<(usize, bool)>>
Polls for receiving a slice of chunks of data from the stream.
§Return value
The function returns:
Poll::Pending
if the stream is waiting to receive data from the peer. In this case, the caller should retry receiving after theWaker
on the providedContext
is notified.Poll::Ready(Ok((count, is_open)))
if the stream received data into the slice, wherecount
was the number of chunks received, andis_open
indicating if the stream is still open. Ifis_open == true
,count
will be at least1
. Ifis_open == false
, future calls topoll_receive_vectored
will always returnPoll::Ready(Ok((0, false)))
.Poll::Ready(Err(e))
if the stream encountered astream::Error
.
sourcepub fn stop_sending(&mut self, error_code: Error) -> Result<()>
pub fn stop_sending(&mut self, error_code: Error) -> Result<()>
Notifies the peer to stop sending data on the stream.
This requests the peer to finish the stream as soon as possible
by issuing a reset
with the
provided error_code
.
Since this is merely a request for the peer to reset the stream, the stream will not immediately be in a reset state after issuing this call.
If the stream has already been reset by the peer or if all data has been received, the call will not trigger any action.
§Return value
The function returns:
Ok(())
if the stop sending message was enqueued for the peer.Err(e)
if the stream encountered astream::Error
.
§Examples
while let Some(stream) = connection.accept_receive_stream().await? {
stream.stop_sending(123u8.into());
}
sourcepub async fn send(&mut self, data: Bytes) -> Result<()>
pub async fn send(&mut self, data: Bytes) -> Result<()>
Enqueues a chunk of data for sending it towards the peer.
§Return value
The function returns:
Ok(())
if the data was enqueued for sending.Err(e)
if the stream encountered astream::Error
.
§Examples
let data = bytes::Bytes::from_static(&[1, 2, 3, 4]);
stream.send(data).await?;
sourcepub fn poll_send(
&mut self,
chunk: &mut Bytes,
cx: &mut Context<'_>,
) -> Poll<Result<()>>
pub fn poll_send( &mut self, chunk: &mut Bytes, cx: &mut Context<'_>, ) -> Poll<Result<()>>
Enqueues a chunk of data for sending it towards the peer.
§Return value
The function returns:
Poll::Pending
if the stream’s send buffer capacity is currently exhausted. In this case, the caller should retry sending after theWaker
on the providedContext
is notified.Poll::Ready(Ok(()))
if the data was enqueued for sending. The providedchunk
will be replaced with an emptyBytes
.Poll::Ready(Err(e))
if the stream encountered astream::Error
.
sourcepub async fn send_vectored(&mut self, chunks: &mut [Bytes]) -> Result<()>
pub async fn send_vectored(&mut self, chunks: &mut [Bytes]) -> Result<()>
Enqueues a slice of chunks of data for sending it towards the peer.
§Return value
The function returns:
Ok(())
if all of the chunks of data were enqueued for sending. Each of the consumedBytes
will be replaced with an emptyBytes
.Err(e)
if the stream encountered astream::Error
.
§Examples
let mut data1 = bytes::Bytes::from_static(&[1, 2, 3]);
let mut data2 = bytes::Bytes::from_static(&[4, 5, 6]);
let mut data3 = bytes::Bytes::from_static(&[7, 8, 9]);
let chunks = [data1, data2, data3];
stream.send_vectored(&mut chunks).await?;
sourcepub fn poll_send_vectored(
&mut self,
chunks: &mut [Bytes],
cx: &mut Context<'_>,
) -> Poll<Result<usize>>
pub fn poll_send_vectored( &mut self, chunks: &mut [Bytes], cx: &mut Context<'_>, ) -> Poll<Result<usize>>
Polls enqueueing a slice of chunks of data for sending it towards the peer.
§Return value
The function returns:
Poll::Pending
if the stream’s send buffer capacity is currently exhausted. In this case, the caller should retry sending after theWaker
on the providedContext
is notified.Poll::Ready(Ok(count))
if one or more chunks of data were enqueued for sending. Any of the consumedBytes
will be replaced with an emptyBytes
. Ifcount
does not equal the total number of chunks, the stream will store the Waker and notify the task once more capacity is available.Poll::Ready(Err(e))
if the stream encountered astream::Error
.
sourcepub fn poll_send_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<usize>>
pub fn poll_send_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<usize>>
Polls send readiness for the given stream.
This method must be called before calling send_data
.
§Return value
The function returns:
Poll::Pending
if the stream’s send buffer capacity is currently exhausted. In this case, the caller should retry sending after theWaker
on the providedContext
is notified.Poll::Ready(Ok(available_bytes))
if the stream is ready to send data, whereavailable_bytes
is how many bytes the stream can currently accept.Poll::Ready(Err(e))
if the stream encountered astream::Error
.
sourcepub fn send_data(&mut self, chunk: Bytes) -> Result<()>
pub fn send_data(&mut self, chunk: Bytes) -> Result<()>
Sends data on the stream without blocking the task.
poll_send_ready
must be called before calling this method.
§Return value
The function returns:
Ok(())
if the data was enqueued for sending.Err(SendingBlocked)
if the stream did not have enough capacity to enqueue thechunk
.Err(e)
if the stream encountered astream::Error
.
sourcepub async fn flush(&mut self) -> Result<()>
pub async fn flush(&mut self) -> Result<()>
Flushes the stream and waits for the peer to receive all outstanding data.
§Return value
The function returns:
Ok(())
if the send buffer was completely flushed and acknowledged by the peer.Err(e)
if the stream encountered astream::Error
.
§Examples
let data = bytes::Bytes::from_static(&[1, 2, 3, 4]);
stream.send(data).await?;
stream.flush().await?;
// at this point, the peer has received all of the `data`
sourcepub fn poll_flush(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>
pub fn poll_flush(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>
Polls flushing the stream and waits for the peer to receive all outstanding data.
§Return value
The function returns:
Poll::Pending
if the stream’s send buffer is still being sent. In this case, the caller should retry sending after theWaker
on the providedContext
is notified.Poll::Ready(Ok(()))
if the send buffer was completely flushed and acknowledged by the peer.Poll::Ready(Err(e))
if the stream encountered astream::Error
.
sourcepub fn finish(&mut self) -> Result<()>
pub fn finish(&mut self) -> Result<()>
Marks the stream as finished.
This method returns immediately without notifying the caller that all of the outstanding
data has been received by the peer. An application wanting to both finish
and flush
the outstanding data can use close
to accomplish
this.
NOTE: This method will be called when the stream
is dropped.
§Return value
The function returns:
Ok(())
if the stream was finished successfully.Err(e)
if the stream encountered astream::Error
.
sourcepub async fn close(&mut self) -> Result<()>
pub async fn close(&mut self) -> Result<()>
Marks the stream as finished and waits for all outstanding data to be acknowledged.
This method is equivalent to calling finish
and flush
.
§Return value
The function returns:
Ok(())
if the send buffer was completely flushed and acknowledged by the peer.Err(e)
if the stream encountered astream::Error
.
§Examples
let data = bytes::Bytes::from_static(&[1, 2, 3, 4]);
stream.send(data).await?;
stream.close().await?;
// at this point, the peer has received all of the `data` and has acknowledged the
// stream being finished.
sourcepub fn poll_close(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>
pub fn poll_close(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>
Marks the stream as finished and polls for all outstanding data to be acknowledged.
This method is equivalent to calling finish
and flush
.
§Return value
The function returns:
Poll::Pending
if the stream’s send buffer is still being sent. In this case, the caller should retry sending after theWaker
on the providedContext
is notified.Poll::Ready(Ok(()))
if the send buffer was completely flushed and acknowledged by the peer.Poll::Ready(Err(e))
if the stream encountered astream::Error
.
sourcepub fn reset(&mut self, error_code: Error) -> Result<()>
pub fn reset(&mut self, error_code: Error) -> Result<()>
Closes the stream with an error code.
After calling this, the stream is closed and will not accept any additional data to be sent to the peer. The peer will also be notified of the error code.
§Return value
The function returns:
Ok(())
if the stream was reset successfully.Err(e)
if the stream encountered astream::Error
. The stream may have been reset previously, or the connection itself was closed.
sourcepub fn split(self) -> (Option<ReceiveStream>, Option<SendStream>)
pub fn split(self) -> (Option<ReceiveStream>, Option<SendStream>)
Splits the stream into ReceiveStream
and
SendStream
halves
§Examples
let (recv, send) = stream.split();
if let Some(recv) = recv {
// the stream has a receive half
}
if let Some(send) = send {
// the stream has a send half
}
Trait Implementations§
source§impl AsyncRead for PeerStream
impl AsyncRead for PeerStream
source§impl AsyncRead for PeerStream
impl AsyncRead for PeerStream
source§impl AsyncWrite for PeerStream
impl AsyncWrite for PeerStream
source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
buf
into the object. Read moresource§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>],
) -> Poll<Result<usize>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>], ) -> Poll<Result<usize>>
poll_write
, except that it writes from a slice of buffers. Read moresource§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
poll_write_vectored
implementation. Read moresource§impl AsyncWrite for PeerStream
impl AsyncWrite for PeerStream
source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
buf
into the object. Read moresource§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>],
) -> Poll<Result<usize>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>], ) -> Poll<Result<usize>>
bufs
into the object using vectored
IO operations. Read moresource§impl Debug for PeerStream
impl Debug for PeerStream
source§impl From<BidirectionalStream> for PeerStream
impl From<BidirectionalStream> for PeerStream
source§fn from(stream: BidirectionalStream) -> Self
fn from(stream: BidirectionalStream) -> Self
source§impl From<ReceiveStream> for PeerStream
impl From<ReceiveStream> for PeerStream
source§fn from(stream: ReceiveStream) -> Self
fn from(stream: ReceiveStream) -> Self
source§impl Sink<Bytes> for PeerStream
impl Sink<Bytes> for PeerStream
§type Error = StreamError
type Error = StreamError
source§fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Sink
to receive a value. Read moresource§fn start_send(self: Pin<&mut Self>, data: Bytes) -> Result<()>
fn start_send(self: Pin<&mut Self>, data: Bytes) -> Result<()>
poll_ready
which returned Poll::Ready(Ok(()))
. Read moresource§impl SplittableStream for PeerStream
impl SplittableStream for PeerStream
source§fn split(self) -> (Option<ReceiveStream>, Option<SendStream>)
fn split(self) -> (Option<ReceiveStream>, Option<SendStream>)
source§impl Stream for PeerStream
impl Stream for PeerStream
§type Item = Result<Bytes, StreamError>
type Item = Result<Bytes, StreamError>
Auto Trait Implementations§
impl Freeze for PeerStream
impl !RefUnwindSafe for PeerStream
impl Send for PeerStream
impl Sync for PeerStream
impl Unpin for PeerStream
impl !UnwindSafe for PeerStream
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>
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,
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,
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,
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,
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,
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,
AsyncWrite
. Read moresource§fn close(&mut self) -> Close<'_, Self>where
Self: Unpin,
fn close(&mut self) -> Close<'_, Self>where
Self: Unpin,
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,
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,
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
source§impl<T, Item> SinkExt<Item> for T
impl<T, Item> SinkExt<Item> for T
source§fn with<U, Fut, F, E>(self, f: F) -> With<Self, Item, U, Fut, F>
fn with<U, Fut, F, E>(self, f: F) -> With<Self, Item, U, Fut, F>
source§fn with_flat_map<U, St, F>(self, f: F) -> WithFlatMap<Self, Item, U, St, F>
fn with_flat_map<U, St, F>(self, f: F) -> WithFlatMap<Self, Item, U, St, F>
source§fn sink_map_err<E, F>(self, f: F) -> SinkMapErr<Self, F>
fn sink_map_err<E, F>(self, f: F) -> SinkMapErr<Self, F>
source§fn sink_err_into<E>(self) -> SinkErrInto<Self, Item, E>
fn sink_err_into<E>(self) -> SinkErrInto<Self, Item, E>
Into
trait. Read moresource§fn buffer(self, capacity: usize) -> Buffer<Self, Item>where
Self: Sized,
fn buffer(self, capacity: usize) -> Buffer<Self, Item>where
Self: Sized,
source§fn flush(&mut self) -> Flush<'_, Self, Item>where
Self: Unpin,
fn flush(&mut self) -> Flush<'_, Self, Item>where
Self: Unpin,
source§fn send(&mut self, item: Item) -> Send<'_, Self, Item>where
Self: Unpin,
fn send(&mut self, item: Item) -> Send<'_, Self, Item>where
Self: Unpin,
source§fn feed(&mut self, item: Item) -> Feed<'_, Self, Item>where
Self: Unpin,
fn feed(&mut self, item: Item) -> Feed<'_, Self, Item>where
Self: Unpin,
source§fn send_all<'a, St>(&'a mut self, stream: &'a mut St) -> SendAll<'a, Self, St>
fn send_all<'a, St>(&'a mut self, stream: &'a mut St) -> SendAll<'a, Self, St>
source§fn right_sink<Si1>(self) -> Either<Si1, Self>
fn right_sink<Si1>(self) -> Either<Si1, Self>
source§fn poll_ready_unpin(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>where
Self: Unpin,
fn poll_ready_unpin(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>where
Self: Unpin,
Sink::poll_ready
on Unpin
sink types.source§fn start_send_unpin(&mut self, item: Item) -> Result<(), Self::Error>where
Self: Unpin,
fn start_send_unpin(&mut self, item: Item) -> Result<(), Self::Error>where
Self: Unpin,
Sink::start_send
on Unpin
sink types.source§impl<T> StreamExt for T
impl<T> StreamExt for T
source§fn next(&mut self) -> Next<'_, Self>where
Self: Unpin,
fn next(&mut self) -> Next<'_, Self>where
Self: Unpin,
source§fn into_future(self) -> StreamFuture<Self>
fn into_future(self) -> StreamFuture<Self>
source§fn map<T, F>(self, f: F) -> Map<Self, F>
fn map<T, F>(self, f: F) -> Map<Self, F>
source§fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
source§fn filter<Fut, F>(self, f: F) -> Filter<Self, Fut, F>
fn filter<Fut, F>(self, f: F) -> Filter<Self, Fut, F>
source§fn filter_map<Fut, T, F>(self, f: F) -> FilterMap<Self, Fut, F>
fn filter_map<Fut, T, F>(self, f: F) -> FilterMap<Self, Fut, F>
source§fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
source§fn collect<C>(self) -> Collect<Self, C>
fn collect<C>(self) -> Collect<Self, C>
source§fn unzip<A, B, FromA, FromB>(self) -> Unzip<Self, FromA, FromB>
fn unzip<A, B, FromA, FromB>(self) -> Unzip<Self, FromA, FromB>
source§fn concat(self) -> Concat<Self>
fn concat(self) -> Concat<Self>
source§fn count(self) -> Count<Self>where
Self: Sized,
fn count(self) -> Count<Self>where
Self: Sized,
source§fn fold<T, Fut, F>(self, init: T, f: F) -> Fold<Self, Fut, T, F>
fn fold<T, Fut, F>(self, init: T, f: F) -> Fold<Self, Fut, T, F>
source§fn any<Fut, F>(self, f: F) -> Any<Self, Fut, F>
fn any<Fut, F>(self, f: F) -> Any<Self, Fut, F>
true
if any element in stream satisfied a predicate. Read moresource§fn all<Fut, F>(self, f: F) -> All<Self, Fut, F>
fn all<Fut, F>(self, f: F) -> All<Self, Fut, F>
true
if all element in stream satisfied a predicate. Read moresource§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
source§fn flatten_unordered(
self,
limit: impl Into<Option<usize>>,
) -> FlattenUnorderedWithFlowController<Self, ()>
fn flatten_unordered( self, limit: impl Into<Option<usize>>, ) -> FlattenUnorderedWithFlowController<Self, ()>
source§fn flat_map_unordered<U, F>(
self,
limit: impl Into<Option<usize>>,
f: F,
) -> FlatMapUnordered<Self, U, F>
fn flat_map_unordered<U, F>( self, limit: impl Into<Option<usize>>, f: F, ) -> FlatMapUnordered<Self, U, F>
StreamExt::map
but flattens nested Stream
s
and polls them concurrently, yielding items in any order, as they made
available. Read moresource§fn scan<S, B, Fut, F>(self, initial_state: S, f: F) -> Scan<Self, S, Fut, F>
fn scan<S, B, Fut, F>(self, initial_state: S, f: F) -> Scan<Self, S, Fut, F>
StreamExt::fold
that holds internal state
and produces a new stream. Read moresource§fn skip_while<Fut, F>(self, f: F) -> SkipWhile<Self, Fut, F>
fn skip_while<Fut, F>(self, f: F) -> SkipWhile<Self, Fut, F>
true
. Read moresource§fn take_while<Fut, F>(self, f: F) -> TakeWhile<Self, Fut, F>
fn take_while<Fut, F>(self, f: F) -> TakeWhile<Self, Fut, F>
true
. Read moresource§fn take_until<Fut>(self, fut: Fut) -> TakeUntil<Self, Fut>
fn take_until<Fut>(self, fut: Fut) -> TakeUntil<Self, Fut>
source§fn for_each<Fut, F>(self, f: F) -> ForEach<Self, Fut, F>
fn for_each<Fut, F>(self, f: F) -> ForEach<Self, Fut, F>
source§fn for_each_concurrent<Fut, F>(
self,
limit: impl Into<Option<usize>>,
f: F,
) -> ForEachConcurrent<Self, Fut, F>
fn for_each_concurrent<Fut, F>( self, limit: impl Into<Option<usize>>, f: F, ) -> ForEachConcurrent<Self, Fut, F>
source§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
n
items of the underlying stream. Read moresource§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
n
items of the underlying stream. Read moresource§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
source§fn boxed<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + Send + 'a>>
fn boxed<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + Send + 'a>>
source§fn boxed_local<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + 'a>>where
Self: Sized + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + 'a>>where
Self: Sized + 'a,
source§fn buffered(self, n: usize) -> Buffered<Self>
fn buffered(self, n: usize) -> Buffered<Self>
source§fn buffer_unordered(self, n: usize) -> BufferUnordered<Self>
fn buffer_unordered(self, n: usize) -> BufferUnordered<Self>
source§fn zip<St>(self, other: St) -> Zip<Self, St>
fn zip<St>(self, other: St) -> Zip<Self, St>
source§fn peekable(self) -> Peekable<Self>where
Self: Sized,
fn peekable(self) -> Peekable<Self>where
Self: Sized,
peek
method. Read moresource§fn chunks(self, capacity: usize) -> Chunks<Self>where
Self: Sized,
fn chunks(self, capacity: usize) -> Chunks<Self>where
Self: Sized,
source§fn ready_chunks(self, capacity: usize) -> ReadyChunks<Self>where
Self: Sized,
fn ready_chunks(self, capacity: usize) -> ReadyChunks<Self>where
Self: Sized,
source§fn forward<S>(self, sink: S) -> Forward<Self, S>
fn forward<S>(self, sink: S) -> Forward<Self, S>
source§fn split<Item>(self) -> (SplitSink<Self, Item>, SplitStream<Self>)
fn split<Item>(self) -> (SplitSink<Self, Item>, SplitStream<Self>)
source§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
source§fn left_stream<B>(self) -> Either<Self, B>
fn left_stream<B>(self) -> Either<Self, B>
source§fn right_stream<B>(self) -> Either<B, Self>
fn right_stream<B>(self) -> Either<B, Self>
source§fn poll_next_unpin(&mut self, cx: &mut Context<'_>) -> Poll<Option<Self::Item>>where
Self: Unpin,
fn poll_next_unpin(&mut self, cx: &mut Context<'_>) -> Poll<Option<Self::Item>>where
Self: Unpin,
Stream::poll_next
on Unpin
stream types.source§fn select_next_some(&mut self) -> SelectNextSome<'_, Self>where
Self: Unpin + FusedStream,
fn select_next_some(&mut self) -> SelectNextSome<'_, Self>where
Self: Unpin + FusedStream,
source§impl<S> TryStreamExt for S
impl<S> TryStreamExt for S
source§fn err_into<E>(self) -> ErrInto<Self, E>
fn err_into<E>(self) -> ErrInto<Self, E>
source§fn map_ok<T, F>(self, f: F) -> MapOk<Self, F>
fn map_ok<T, F>(self, f: F) -> MapOk<Self, F>
source§fn map_err<E, F>(self, f: F) -> MapErr<Self, F>
fn map_err<E, F>(self, f: F) -> MapErr<Self, F>
source§fn and_then<Fut, F>(self, f: F) -> AndThen<Self, Fut, F>
fn and_then<Fut, F>(self, f: F) -> AndThen<Self, Fut, F>
f
. Read moresource§fn or_else<Fut, F>(self, f: F) -> OrElse<Self, Fut, F>
fn or_else<Fut, F>(self, f: F) -> OrElse<Self, Fut, F>
f
. Read moresource§fn inspect_ok<F>(self, f: F) -> InspectOk<Self, F>
fn inspect_ok<F>(self, f: F) -> InspectOk<Self, F>
source§fn inspect_err<F>(self, f: F) -> InspectErr<Self, F>
fn inspect_err<F>(self, f: F) -> InspectErr<Self, F>
source§fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
source§fn try_next(&mut self) -> TryNext<'_, Self>where
Self: Unpin,
fn try_next(&mut self) -> TryNext<'_, Self>where
Self: Unpin,
source§fn try_for_each<Fut, F>(self, f: F) -> TryForEach<Self, Fut, F>
fn try_for_each<Fut, F>(self, f: F) -> TryForEach<Self, Fut, F>
source§fn try_skip_while<Fut, F>(self, f: F) -> TrySkipWhile<Self, Fut, F>
fn try_skip_while<Fut, F>(self, f: F) -> TrySkipWhile<Self, Fut, F>
true
. Read moresource§fn try_take_while<Fut, F>(self, f: F) -> TryTakeWhile<Self, Fut, F>
fn try_take_while<Fut, F>(self, f: F) -> TryTakeWhile<Self, Fut, F>
true
. Read moresource§fn try_for_each_concurrent<Fut, F>(
self,
limit: impl Into<Option<usize>>,
f: F,
) -> TryForEachConcurrent<Self, Fut, F>
fn try_for_each_concurrent<Fut, F>( self, limit: impl Into<Option<usize>>, f: F, ) -> TryForEachConcurrent<Self, Fut, F>
source§fn try_collect<C>(self) -> TryCollect<Self, C>
fn try_collect<C>(self) -> TryCollect<Self, C>
source§fn try_chunks(self, capacity: usize) -> TryChunks<Self>where
Self: Sized,
fn try_chunks(self, capacity: usize) -> TryChunks<Self>where
Self: Sized,
source§fn try_ready_chunks(self, capacity: usize) -> TryReadyChunks<Self>where
Self: Sized,
fn try_ready_chunks(self, capacity: usize) -> TryReadyChunks<Self>where
Self: Sized,
source§fn try_filter<Fut, F>(self, f: F) -> TryFilter<Self, Fut, F>
fn try_filter<Fut, F>(self, f: F) -> TryFilter<Self, Fut, F>
source§fn try_filter_map<Fut, F, T>(self, f: F) -> TryFilterMap<Self, Fut, F>
fn try_filter_map<Fut, F, T>(self, f: F) -> TryFilterMap<Self, Fut, F>
source§fn try_flatten_unordered(
self,
limit: impl Into<Option<usize>>,
) -> TryFlattenUnordered<Self>
fn try_flatten_unordered( self, limit: impl Into<Option<usize>>, ) -> TryFlattenUnordered<Self>
source§fn try_flatten(self) -> TryFlatten<Self>
fn try_flatten(self) -> TryFlatten<Self>
source§fn try_fold<T, Fut, F>(self, init: T, f: F) -> TryFold<Self, Fut, T, F>
fn try_fold<T, Fut, F>(self, init: T, f: F) -> TryFold<Self, Fut, T, F>
source§fn try_concat(self) -> TryConcat<Self>
fn try_concat(self) -> TryConcat<Self>
source§fn try_buffer_unordered(self, n: usize) -> TryBufferUnordered<Self>
fn try_buffer_unordered(self, n: usize) -> TryBufferUnordered<Self>
source§fn try_buffered(self, n: usize) -> TryBuffered<Self>
fn try_buffered(self, n: usize) -> TryBuffered<Self>
source§fn try_poll_next_unpin(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Option<Result<Self::Ok, Self::Error>>>where
Self: Unpin,
fn try_poll_next_unpin(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Option<Result<Self::Ok, Self::Error>>>where
Self: Unpin,
TryStream::try_poll_next
on Unpin
stream types.source§fn into_async_read(self) -> IntoAsyncRead<Self>
fn into_async_read(self) -> IntoAsyncRead<Self>
AsyncBufRead
. Read moresource§fn try_all<Fut, F>(self, f: F) -> TryAll<Self, Fut, F>
fn try_all<Fut, F>(self, f: F) -> TryAll<Self, Fut, F>
Err
is encountered or if an Ok
item is found
that does not satisfy the predicate. Read more