Struct futures_util::stream::Peekable
source · pub struct Peekable<St: Stream> { /* private fields */ }
Expand description
A Stream
that implements a peek
method.
The peek
method can be used to retrieve a reference
to the next Stream::Item
if available. A subsequent
call to poll
will return the owned item.
Implementations§
source§impl<St: Stream> Peekable<St>
impl<St: Stream> Peekable<St>
sourcepub fn get_ref(&self) -> &St
pub fn get_ref(&self) -> &St
Acquires a reference to the underlying sink or stream that this combinator is pulling from.
sourcepub fn get_mut(&mut self) -> &mut St
pub fn get_mut(&mut self) -> &mut St
Acquires a mutable reference to the underlying sink or stream that this combinator is pulling from.
Note that care must be taken to avoid tampering with the state of the sink or stream which may otherwise confuse this combinator.
sourcepub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut St>
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut St>
Acquires a pinned mutable reference to the underlying sink or stream that this combinator is pulling from.
Note that care must be taken to avoid tampering with the state of the sink or stream which may otherwise confuse this combinator.
sourcepub fn into_inner(self) -> St
pub fn into_inner(self) -> St
Consumes this combinator, returning the underlying sink or stream.
Note that this may discard intermediate state of this combinator, so care should be taken to avoid losing resources when this is called.
sourcepub fn peek(self: Pin<&mut Self>) -> Peek<'_, St> ⓘ
pub fn peek(self: Pin<&mut Self>) -> Peek<'_, St> ⓘ
Produces a future which retrieves a reference to the next item
in the stream, or None
if the underlying stream terminates.
sourcepub fn poll_peek(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> Poll<Option<&St::Item>>
pub fn poll_peek( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll<Option<&St::Item>>
Peek retrieves a reference to the next item in the stream.
This method polls the underlying stream and return either a reference to the next item if the stream is ready or passes through any errors.
sourcepub fn peek_mut(self: Pin<&mut Self>) -> PeekMut<'_, St> ⓘ
pub fn peek_mut(self: Pin<&mut Self>) -> PeekMut<'_, St> ⓘ
Produces a future which retrieves a mutable reference to the next item
in the stream, or None
if the underlying stream terminates.
Examples
use futures::stream::{self, StreamExt};
use futures::pin_mut;
let stream = stream::iter(vec![1, 2, 3]).peekable();
pin_mut!(stream);
assert_eq!(stream.as_mut().peek_mut().await, Some(&mut 1));
assert_eq!(stream.as_mut().next().await, Some(1));
// Peek into the stream and modify the value which will be returned next
if let Some(p) = stream.as_mut().peek_mut().await {
if *p == 2 {
*p = 5;
}
}
assert_eq!(stream.collect::<Vec<_>>().await, vec![5, 3]);
sourcepub fn poll_peek_mut(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> Poll<Option<&mut St::Item>>
pub fn poll_peek_mut( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll<Option<&mut St::Item>>
Peek retrieves a mutable reference to the next item in the stream.
sourcepub fn next_if<F>(self: Pin<&mut Self>, func: F) -> NextIf<'_, St, F> ⓘwhere
F: FnOnce(&St::Item) -> bool,
pub fn next_if<F>(self: Pin<&mut Self>, func: F) -> NextIf<'_, St, F> ⓘwhere F: FnOnce(&St::Item) -> bool,
Creates a future which will consume and return the next value of this stream if a condition is true.
If func
returns true
for the next value of this stream, consume and
return it. Otherwise, return None
.
Examples
Consume a number if it’s equal to 0.
use futures::stream::{self, StreamExt};
use futures::pin_mut;
let stream = stream::iter(0..5).peekable();
pin_mut!(stream);
// The first item of the stream is 0; consume it.
assert_eq!(stream.as_mut().next_if(|&x| x == 0).await, Some(0));
// The next item returned is now 1, so `consume` will return `false`.
assert_eq!(stream.as_mut().next_if(|&x| x == 0).await, None);
// `next_if` saves the value of the next item if it was not equal to `expected`.
assert_eq!(stream.next().await, Some(1));
Consume any number less than 10.
use futures::stream::{self, StreamExt};
use futures::pin_mut;
let stream = stream::iter(1..20).peekable();
pin_mut!(stream);
// Consume all numbers less than 10
while stream.as_mut().next_if(|&x| x < 10).await.is_some() {}
// The next value returned will be 10
assert_eq!(stream.next().await, Some(10));
sourcepub fn next_if_eq<'a, T>(
self: Pin<&'a mut Self>,
expected: &'a T
) -> NextIfEq<'a, St, T> ⓘwhere
T: ?Sized,
St::Item: PartialEq<T>,
pub fn next_if_eq<'a, T>( self: Pin<&'a mut Self>, expected: &'a T ) -> NextIfEq<'a, St, T> ⓘwhere T: ?Sized, St::Item: PartialEq<T>,
Creates a future which will consume and return the next item if it is
equal to expected
.
Example
Consume a number if it’s equal to 0.
use futures::stream::{self, StreamExt};
use futures::pin_mut;
let stream = stream::iter(0..5).peekable();
pin_mut!(stream);
// The first item of the stream is 0; consume it.
assert_eq!(stream.as_mut().next_if_eq(&0).await, Some(0));
// The next item returned is now 1, so `consume` will return `false`.
assert_eq!(stream.as_mut().next_if_eq(&0).await, None);
// `next_if_eq` saves the value of the next item if it was not equal to `expected`.
assert_eq!(stream.next().await, Some(1));
Trait Implementations§
source§impl<St: Stream> FusedStream for Peekable<St>
impl<St: Stream> FusedStream for Peekable<St>
source§fn is_terminated(&self) -> bool
fn is_terminated(&self) -> bool
true
if the stream should no longer be polled.source§impl<S, Item> Sink<Item> for Peekable<S>where
S: Sink<Item> + Stream,
impl<S, Item> Sink<Item> for Peekable<S>where S: Sink<Item> + Stream,
source§fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll<Result<(), Self::Error>>
Sink
to receive a value. Read moresource§fn start_send(self: Pin<&mut Self>, item: Item) -> Result<(), Self::Error>
fn start_send(self: Pin<&mut Self>, item: Item) -> Result<(), Self::Error>
poll_ready
which returned Poll::Ready(Ok(()))
. Read moresource§impl<S: Stream> Stream for Peekable<S>
impl<S: Stream> Stream for Peekable<S>
impl<'__pin, St: Stream> Unpin for Peekable<St>where __Origin<'__pin, St>: Unpin,
Auto Trait Implementations§
impl<St> RefUnwindSafe for Peekable<St>where St: RefUnwindSafe, <St as Stream>::Item: RefUnwindSafe,
impl<St> Send for Peekable<St>where St: Send, <St as Stream>::Item: Send,
impl<St> Sync for Peekable<St>where St: Sync, <St as Stream>::Item: Sync,
impl<St> UnwindSafe for Peekable<St>where St: UnwindSafe, <St as Stream>::Item: UnwindSafe,
Blanket Implementations§
source§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 Twhere
T: Sink<Item> + ?Sized,
impl<T, Item> SinkExt<Item> for Twhere T: Sink<Item> + ?Sized,
source§fn with<U, Fut, F, E>(self, f: F) -> With<Self, Item, U, Fut, F>where
F: FnMut(U) -> Fut,
Fut: Future<Output = Result<Item, E>>,
E: From<Self::Error>,
Self: Sized,
fn with<U, Fut, F, E>(self, f: F) -> With<Self, Item, U, Fut, F>where F: FnMut(U) -> Fut, Fut: Future<Output = Result<Item, E>>, E: From<Self::Error>, Self: Sized,
source§fn with_flat_map<U, St, F>(self, f: F) -> WithFlatMap<Self, Item, U, St, F>where
F: FnMut(U) -> St,
St: Stream<Item = Result<Item, Self::Error>>,
Self: Sized,
fn with_flat_map<U, St, F>(self, f: F) -> WithFlatMap<Self, Item, U, St, F>where F: FnMut(U) -> St, St: Stream<Item = Result<Item, Self::Error>>, Self: Sized,
source§fn sink_map_err<E, F>(self, f: F) -> SinkMapErr<Self, F>where
F: FnOnce(Self::Error) -> E,
Self: Sized,
fn sink_map_err<E, F>(self, f: F) -> SinkMapErr<Self, F>where F: FnOnce(Self::Error) -> E, Self: Sized,
source§fn sink_err_into<E>(self) -> SinkErrInto<Self, Item, E>where
Self: Sized,
Self::Error: Into<E>,
fn sink_err_into<E>(self) -> SinkErrInto<Self, Item, E>where Self: Sized, Self::Error: Into<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 fanout<Si>(self, other: Si) -> Fanout<Self, Si>where
Self: Sized,
Item: Clone,
Si: Sink<Item, Error = Self::Error>,
fn fanout<Si>(self, other: Si) -> Fanout<Self, Si>where Self: Sized, Item: Clone, Si: Sink<Item, Error = Self::Error>,
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> ⓘwhere
St: TryStream<Ok = Item, Error = Self::Error> + Stream + Unpin + ?Sized,
Self: Unpin,
fn send_all<'a, St>(&'a mut self, stream: &'a mut St) -> SendAll<'a, Self, St> ⓘwhere St: TryStream<Ok = Item, Error = Self::Error> + Stream + Unpin + ?Sized, Self: Unpin,
source§fn left_sink<Si2>(self) -> Either<Self, Si2> ⓘwhere
Si2: Sink<Item, Error = Self::Error>,
Self: Sized,
fn left_sink<Si2>(self) -> Either<Self, Si2> ⓘwhere Si2: Sink<Item, Error = Self::Error>, Self: Sized,
source§fn right_sink<Si1>(self) -> Either<Si1, Self> ⓘwhere
Si1: Sink<Item, Error = Self::Error>,
Self: Sized,
fn right_sink<Si1>(self) -> Either<Si1, Self> ⓘwhere Si1: Sink<Item, Error = Self::Error>, Self: Sized,
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 Twhere
T: Stream + ?Sized,
impl<T> StreamExt for Twhere T: Stream + ?Sized,
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> ⓘwhere
Self: Sized + Unpin,
fn into_future(self) -> StreamFuture<Self> ⓘwhere Self: Sized + Unpin,
source§fn map<T, F>(self, f: F) -> Map<Self, F>where
F: FnMut(Self::Item) -> T,
Self: Sized,
fn map<T, F>(self, f: F) -> Map<Self, F>where F: FnMut(Self::Item) -> T, Self: Sized,
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>where
F: FnMut(&Self::Item) -> Fut,
Fut: Future<Output = bool>,
Self: Sized,
fn filter<Fut, F>(self, f: F) -> Filter<Self, Fut, F>where F: FnMut(&Self::Item) -> Fut, Fut: Future<Output = bool>, Self: Sized,
source§fn filter_map<Fut, T, F>(self, f: F) -> FilterMap<Self, Fut, F>where
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = Option<T>>,
Self: Sized,
fn filter_map<Fut, T, F>(self, f: F) -> FilterMap<Self, Fut, F>where F: FnMut(Self::Item) -> Fut, Fut: Future<Output = Option<T>>, Self: Sized,
source§fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>where
F: FnMut(Self::Item) -> Fut,
Fut: Future,
Self: Sized,
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>where F: FnMut(Self::Item) -> Fut, Fut: Future, Self: Sized,
source§fn collect<C: Default + Extend<Self::Item>>(self) -> Collect<Self, C> ⓘwhere
Self: Sized,
fn collect<C: Default + Extend<Self::Item>>(self) -> Collect<Self, C> ⓘwhere Self: Sized,
source§fn unzip<A, B, FromA, FromB>(self) -> Unzip<Self, FromA, FromB> ⓘwhere
FromA: Default + Extend<A>,
FromB: Default + Extend<B>,
Self: Sized + Stream<Item = (A, B)>,
fn unzip<A, B, FromA, FromB>(self) -> Unzip<Self, FromA, FromB> ⓘwhere FromA: Default + Extend<A>, FromB: Default + Extend<B>, Self: Sized + Stream<Item = (A, B)>,
source§fn concat(self) -> Concat<Self> ⓘwhere
Self: Sized,
Self::Item: Extend<<<Self as Stream>::Item as IntoIterator>::Item> + IntoIterator + Default,
fn concat(self) -> Concat<Self> ⓘwhere Self: Sized, Self::Item: Extend<<<Self as Stream>::Item as IntoIterator>::Item> + IntoIterator + Default,
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> ⓘwhere
F: FnMut(T, Self::Item) -> Fut,
Fut: Future<Output = T>,
Self: Sized,
fn fold<T, Fut, F>(self, init: T, f: F) -> Fold<Self, Fut, T, F> ⓘwhere F: FnMut(T, Self::Item) -> Fut, Fut: Future<Output = T>, Self: Sized,
source§fn any<Fut, F>(self, f: F) -> Any<Self, Fut, F> ⓘwhere
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = bool>,
Self: Sized,
fn any<Fut, F>(self, f: F) -> Any<Self, Fut, F> ⓘwhere F: FnMut(Self::Item) -> Fut, Fut: Future<Output = bool>, Self: Sized,
true
if any element in stream satisfied a predicate. Read moresource§fn all<Fut, F>(self, f: F) -> All<Self, Fut, F> ⓘwhere
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = bool>,
Self: Sized,
fn all<Fut, F>(self, f: F) -> All<Self, Fut, F> ⓘwhere F: FnMut(Self::Item) -> Fut, Fut: Future<Output = bool>, Self: Sized,
true
if all element in stream satisfied a predicate. Read moresource§fn flatten(self) -> Flatten<Self>where
Self::Item: Stream,
Self: Sized,
fn flatten(self) -> Flatten<Self>where Self::Item: Stream, Self: Sized,
source§fn flatten_unordered(
self,
limit: impl Into<Option<usize>>
) -> FlattenUnordered<Self>where
Self::Item: Stream + Unpin,
Self: Sized,
fn flatten_unordered( self, limit: impl Into<Option<usize>> ) -> FlattenUnordered<Self>where Self::Item: Stream + Unpin, Self: Sized,
source§fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where
F: FnMut(Self::Item) -> U,
U: Stream,
Self: Sized,
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where F: FnMut(Self::Item) -> U, U: Stream, Self: Sized,
source§fn flat_map_unordered<U, F>(
self,
limit: impl Into<Option<usize>>,
f: F
) -> FlatMapUnordered<Self, U, F>where
U: Stream + Unpin,
F: FnMut(Self::Item) -> U,
Self: Sized,
fn flat_map_unordered<U, F>( self, limit: impl Into<Option<usize>>, f: F ) -> FlatMapUnordered<Self, U, F>where U: Stream + Unpin, F: FnMut(Self::Item) -> U, Self: Sized,
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>where
F: FnMut(&mut S, Self::Item) -> Fut,
Fut: Future<Output = Option<B>>,
Self: Sized,
fn scan<S, B, Fut, F>(self, initial_state: S, f: F) -> Scan<Self, S, Fut, F>where F: FnMut(&mut S, Self::Item) -> Fut, Fut: Future<Output = Option<B>>, Self: Sized,
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>where
F: FnMut(&Self::Item) -> Fut,
Fut: Future<Output = bool>,
Self: Sized,
fn skip_while<Fut, F>(self, f: F) -> SkipWhile<Self, Fut, F>where F: FnMut(&Self::Item) -> Fut, Fut: Future<Output = bool>, Self: Sized,
true
. Read moresource§fn take_while<Fut, F>(self, f: F) -> TakeWhile<Self, Fut, F>where
F: FnMut(&Self::Item) -> Fut,
Fut: Future<Output = bool>,
Self: Sized,
fn take_while<Fut, F>(self, f: F) -> TakeWhile<Self, Fut, F>where F: FnMut(&Self::Item) -> Fut, Fut: Future<Output = bool>, Self: Sized,
true
. Read moresource§fn take_until<Fut>(self, fut: Fut) -> TakeUntil<Self, Fut>where
Fut: Future,
Self: Sized,
fn take_until<Fut>(self, fut: Fut) -> TakeUntil<Self, Fut>where Fut: Future, Self: Sized,
source§fn for_each<Fut, F>(self, f: F) -> ForEach<Self, Fut, F> ⓘwhere
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = ()>,
Self: Sized,
fn for_each<Fut, F>(self, f: F) -> ForEach<Self, Fut, F> ⓘwhere F: FnMut(Self::Item) -> Fut, Fut: Future<Output = ()>, Self: Sized,
source§fn for_each_concurrent<Fut, F>(
self,
limit: impl Into<Option<usize>>,
f: F
) -> ForEachConcurrent<Self, Fut, F> ⓘwhere
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = ()>,
Self: Sized,
fn for_each_concurrent<Fut, F>( self, limit: impl Into<Option<usize>>, f: F ) -> ForEachConcurrent<Self, Fut, F> ⓘwhere F: FnMut(Self::Item) -> Fut, Fut: Future<Output = ()>, Self: Sized,
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) -> BoxStream<'a, Self::Item>where
Self: Sized + Send + 'a,
fn boxed<'a>(self) -> BoxStream<'a, Self::Item>where Self: Sized + Send + 'a,
source§fn boxed_local<'a>(self) -> LocalBoxStream<'a, Self::Item>where
Self: Sized + 'a,
fn boxed_local<'a>(self) -> LocalBoxStream<'a, Self::Item>where Self: Sized + 'a,
source§fn buffered(self, n: usize) -> Buffered<Self>where
Self::Item: Future,
Self: Sized,
fn buffered(self, n: usize) -> Buffered<Self>where Self::Item: Future, Self: Sized,
source§fn buffer_unordered(self, n: usize) -> BufferUnordered<Self>where
Self::Item: Future,
Self: Sized,
fn buffer_unordered(self, n: usize) -> BufferUnordered<Self>where Self::Item: Future, Self: Sized,
source§fn zip<St>(self, other: St) -> Zip<Self, St>where
St: Stream,
Self: Sized,
fn zip<St>(self, other: St) -> Zip<Self, St>where St: Stream, Self: Sized,
source§fn chain<St>(self, other: St) -> Chain<Self, St>where
St: Stream<Item = Self::Item>,
Self: Sized,
fn chain<St>(self, other: St) -> Chain<Self, St>where St: Stream<Item = Self::Item>, Self: Sized,
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> ⓘwhere
S: Sink<Self::Ok, Error = Self::Error>,
Self: TryStream + Sized,
fn forward<S>(self, sink: S) -> Forward<Self, S> ⓘwhere S: Sink<Self::Ok, Error = Self::Error>, Self: TryStream + Sized,
source§fn split<Item>(self) -> (SplitSink<Self, Item>, SplitStream<Self>)where
Self: Sink<Item> + Sized,
fn split<Item>(self) -> (SplitSink<Self, Item>, SplitStream<Self>)where Self: Sink<Item> + Sized,
source§fn inspect<F>(self, f: F) -> Inspect<Self, F>where
F: FnMut(&Self::Item),
Self: Sized,
fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: FnMut(&Self::Item), Self: Sized,
source§fn right_stream<B>(self) -> Either<B, Self> ⓘwhere
B: Stream<Item = Self::Item>,
Self: Sized,
fn right_stream<B>(self) -> Either<B, Self> ⓘwhere B: Stream<Item = Self::Item>, Self: Sized,
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 Swhere
S: TryStream + ?Sized,
impl<S> TryStreamExt for Swhere S: TryStream + ?Sized,
source§fn err_into<E>(self) -> ErrInto<Self, E>where
Self: Sized,
Self::Error: Into<E>,
fn err_into<E>(self) -> ErrInto<Self, E>where Self: Sized, Self::Error: Into<E>,
source§fn map_ok<T, F>(self, f: F) -> MapOk<Self, F>where
Self: Sized,
F: FnMut(Self::Ok) -> T,
fn map_ok<T, F>(self, f: F) -> MapOk<Self, F>where Self: Sized, F: FnMut(Self::Ok) -> T,
source§fn map_err<E, F>(self, f: F) -> MapErr<Self, F>where
Self: Sized,
F: FnMut(Self::Error) -> E,
fn map_err<E, F>(self, f: F) -> MapErr<Self, F>where Self: Sized, F: FnMut(Self::Error) -> E,
source§fn and_then<Fut, F>(self, f: F) -> AndThen<Self, Fut, F>where
F: FnMut(Self::Ok) -> Fut,
Fut: TryFuture<Error = Self::Error>,
Self: Sized,
fn and_then<Fut, F>(self, f: F) -> AndThen<Self, Fut, F>where F: FnMut(Self::Ok) -> Fut, Fut: TryFuture<Error = Self::Error>, Self: Sized,
f
. Read moresource§fn or_else<Fut, F>(self, f: F) -> OrElse<Self, Fut, F>where
F: FnMut(Self::Error) -> Fut,
Fut: TryFuture<Ok = Self::Ok>,
Self: Sized,
fn or_else<Fut, F>(self, f: F) -> OrElse<Self, Fut, F>where F: FnMut(Self::Error) -> Fut, Fut: TryFuture<Ok = Self::Ok>, Self: Sized,
f
. Read moresource§fn inspect_ok<F>(self, f: F) -> InspectOk<Self, F>where
F: FnMut(&Self::Ok),
Self: Sized,
fn inspect_ok<F>(self, f: F) -> InspectOk<Self, F>where F: FnMut(&Self::Ok), Self: Sized,
source§fn inspect_err<F>(self, f: F) -> InspectErr<Self, F>where
F: FnMut(&Self::Error),
Self: Sized,
fn inspect_err<F>(self, f: F) -> InspectErr<Self, F>where F: FnMut(&Self::Error), Self: Sized,
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> ⓘwhere
F: FnMut(Self::Ok) -> Fut,
Fut: TryFuture<Ok = (), Error = Self::Error>,
Self: Sized,
fn try_for_each<Fut, F>(self, f: F) -> TryForEach<Self, Fut, F> ⓘwhere F: FnMut(Self::Ok) -> Fut, Fut: TryFuture<Ok = (), Error = Self::Error>, Self: Sized,
source§fn try_skip_while<Fut, F>(self, f: F) -> TrySkipWhile<Self, Fut, F>where
F: FnMut(&Self::Ok) -> Fut,
Fut: TryFuture<Ok = bool, Error = Self::Error>,
Self: Sized,
fn try_skip_while<Fut, F>(self, f: F) -> TrySkipWhile<Self, Fut, F>where F: FnMut(&Self::Ok) -> Fut, Fut: TryFuture<Ok = bool, Error = Self::Error>, Self: Sized,
true
. Read moresource§fn try_take_while<Fut, F>(self, f: F) -> TryTakeWhile<Self, Fut, F>where
F: FnMut(&Self::Ok) -> Fut,
Fut: TryFuture<Ok = bool, Error = Self::Error>,
Self: Sized,
fn try_take_while<Fut, F>(self, f: F) -> TryTakeWhile<Self, Fut, F>where F: FnMut(&Self::Ok) -> Fut, Fut: TryFuture<Ok = bool, Error = Self::Error>, Self: Sized,
true
. Read moresource§fn try_for_each_concurrent<Fut, F>(
self,
limit: impl Into<Option<usize>>,
f: F
) -> TryForEachConcurrent<Self, Fut, F> ⓘwhere
F: FnMut(Self::Ok) -> Fut,
Fut: Future<Output = Result<(), Self::Error>>,
Self: Sized,
fn try_for_each_concurrent<Fut, F>( self, limit: impl Into<Option<usize>>, f: F ) -> TryForEachConcurrent<Self, Fut, F> ⓘwhere F: FnMut(Self::Ok) -> Fut, Fut: Future<Output = Result<(), Self::Error>>, Self: Sized,
source§fn try_collect<C: Default + Extend<Self::Ok>>(self) -> TryCollect<Self, C> ⓘwhere
Self: Sized,
fn try_collect<C: Default + Extend<Self::Ok>>(self) -> TryCollect<Self, C> ⓘwhere Self: Sized,
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>where
Fut: Future<Output = bool>,
F: FnMut(&Self::Ok) -> Fut,
Self: Sized,
fn try_filter<Fut, F>(self, f: F) -> TryFilter<Self, Fut, F>where Fut: Future<Output = bool>, F: FnMut(&Self::Ok) -> Fut, Self: Sized,
source§fn try_filter_map<Fut, F, T>(self, f: F) -> TryFilterMap<Self, Fut, F>where
Fut: TryFuture<Ok = Option<T>, Error = Self::Error>,
F: FnMut(Self::Ok) -> Fut,
Self: Sized,
fn try_filter_map<Fut, F, T>(self, f: F) -> TryFilterMap<Self, Fut, F>where Fut: TryFuture<Ok = Option<T>, Error = Self::Error>, F: FnMut(Self::Ok) -> Fut, Self: Sized,
source§fn try_flatten_unordered(
self,
limit: impl Into<Option<usize>>
) -> TryFlattenUnordered<Self>where
Self::Ok: TryStream + Unpin,
<Self::Ok as TryStream>::Error: From<Self::Error>,
Self: Sized,
fn try_flatten_unordered( self, limit: impl Into<Option<usize>> ) -> TryFlattenUnordered<Self>where Self::Ok: TryStream + Unpin, <Self::Ok as TryStream>::Error: From<Self::Error>, Self: Sized,
source§fn try_flatten(self) -> TryFlatten<Self>where
Self::Ok: TryStream,
<Self::Ok as TryStream>::Error: From<Self::Error>,
Self: Sized,
fn try_flatten(self) -> TryFlatten<Self>where Self::Ok: TryStream, <Self::Ok as TryStream>::Error: From<Self::Error>, Self: Sized,
source§fn try_fold<T, Fut, F>(self, init: T, f: F) -> TryFold<Self, Fut, T, F> ⓘwhere
F: FnMut(T, Self::Ok) -> Fut,
Fut: TryFuture<Ok = T, Error = Self::Error>,
Self: Sized,
fn try_fold<T, Fut, F>(self, init: T, f: F) -> TryFold<Self, Fut, T, F> ⓘwhere F: FnMut(T, Self::Ok) -> Fut, Fut: TryFuture<Ok = T, Error = Self::Error>, Self: Sized,
source§fn try_concat(self) -> TryConcat<Self> ⓘwhere
Self: Sized,
Self::Ok: Extend<<<Self as TryStream>::Ok as IntoIterator>::Item> + IntoIterator + Default,
fn try_concat(self) -> TryConcat<Self> ⓘwhere Self: Sized, Self::Ok: Extend<<<Self as TryStream>::Ok as IntoIterator>::Item> + IntoIterator + Default,
source§fn try_buffer_unordered(self, n: usize) -> TryBufferUnordered<Self>where
Self::Ok: TryFuture<Error = Self::Error>,
Self: Sized,
fn try_buffer_unordered(self, n: usize) -> TryBufferUnordered<Self>where Self::Ok: TryFuture<Error = Self::Error>, Self: Sized,
source§fn try_buffered(self, n: usize) -> TryBuffered<Self>where
Self::Ok: TryFuture<Error = Self::Error>,
Self: Sized,
fn try_buffered(self, n: usize) -> TryBuffered<Self>where Self::Ok: TryFuture<Error = Self::Error>, Self: Sized,
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>where
Self: Sized + TryStreamExt<Error = Error>,
Self::Ok: AsRef<[u8]>,
fn into_async_read(self) -> IntoAsyncRead<Self>where Self: Sized + TryStreamExt<Error = Error>, Self::Ok: AsRef<[u8]>,
AsyncBufRead
. Read moresource§fn try_all<Fut, F>(self, f: F) -> TryAll<Self, Fut, F> ⓘwhere
Self: Sized,
F: FnMut(Self::Ok) -> Fut,
Fut: Future<Output = bool>,
fn try_all<Fut, F>(self, f: F) -> TryAll<Self, Fut, F> ⓘwhere Self: Sized, F: FnMut(Self::Ok) -> Fut, Fut: Future<Output = bool>,
Err
is encountered or if an Ok
item is found
that does not satisfy the predicate. Read moresource§fn try_any<Fut, F>(self, f: F) -> TryAny<Self, Fut, F> ⓘwhere
Self: Sized,
F: FnMut(Self::Ok) -> Fut,
Fut: Future<Output = bool>,
fn try_any<Fut, F>(self, f: F) -> TryAny<Self, Fut, F> ⓘwhere Self: Sized, F: FnMut(Self::Ok) -> Fut, Fut: Future<Output = bool>,
Err
is encountered or if an Ok
item is found
that satisfies the predicate. Read more