pub trait TryStreamExtwhere
Self: TryStream,{
// Required methods
fn try_enumerate(self) -> TryEnumerate<Self, Self::Ok, Self::Error>;
fn take_until_error(self) -> TakeUntilError<Self, Self::Ok, Self::Error>;
fn catch_error(self) -> (ErrorNotify<Self::Error>, CatchError<Self>);
fn try_stateful_then<B, U, F, Fut>(
self,
init: B,
f: F,
) -> TryStatefulThen<Self, B, Self::Ok, U, Self::Error, F, Fut>
where F: FnMut(B, Self::Ok) -> Fut,
Fut: Future<Output = Result<Option<(B, U)>, Self::Error>>;
fn try_stateful_map<B, U, F>(
self,
init: B,
f: F,
) -> TryStatefulMap<Self, B, Self::Ok, U, Self::Error, F>
where F: FnMut(B, Self::Ok) -> Result<Option<(B, U)>, Self::Error>;
}Expand description
The trait extends TryStream types with combinators.
Required Methods§
Sourcefn try_enumerate(self) -> TryEnumerate<Self, Self::Ok, Self::Error>
fn try_enumerate(self) -> TryEnumerate<Self, Self::Ok, Self::Error>
Create a fallible stream that gives the current iteration count.
§Overflow Behavior
The method does no guarding against overflows, so enumerating more than usize::MAX
elements either produces the wrong result or panics. If debug assertions are enabled, a panic is guaranteed.
Panics
The returned iterator might panic if the to-be-returned index would overflow a usize.
Sourcefn take_until_error(self) -> TakeUntilError<Self, Self::Ok, Self::Error>
fn take_until_error(self) -> TakeUntilError<Self, Self::Ok, Self::Error>
Takes elements until an Err(_).
Sourcefn catch_error(self) -> (ErrorNotify<Self::Error>, CatchError<Self>)
fn catch_error(self) -> (ErrorNotify<Self::Error>, CatchError<Self>)
Split the stream of Result<T, E> to a stream of T and a future of Result<(), E>.
The method returns (future, stream). If this combinator encoutners an Err,
future.await returns that error, and returned stream fuses. If the input
stream is depleted without error, future.await resolves to Ok(()).
Sourcefn try_stateful_then<B, U, F, Fut>(
self,
init: B,
f: F,
) -> TryStatefulThen<Self, B, Self::Ok, U, Self::Error, F, Fut>
fn try_stateful_then<B, U, F, Fut>( self, init: B, f: F, ) -> TryStatefulThen<Self, B, Self::Ok, U, Self::Error, F, Fut>
Similar to and_then but with a state.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.