pub trait TryReadyExt<T, E, S>{
// Required methods
fn ready_and_then<U, F>(
self,
f: F,
) -> AndThen<Self, Ready<Result<U, E>>, impl FnMut(S::Ok) -> Ready<Result<U, E>>>
where F: Fn(S::Ok) -> Result<U, E>;
fn ready_try_filter<F>(
self,
f: F,
) -> TryFilter<Self, Ready<bool>, impl FnMut(&S::Ok) -> Ready<bool>>
where F: Fn(&S::Ok) -> bool;
fn ready_try_filter_map<F, U>(
self,
f: F,
) -> TryFilterMap<Self, Ready<Result<Option<U>, E>>, impl FnMut(S::Ok) -> Ready<Result<Option<U>, E>>>
where F: Fn(S::Ok) -> Result<Option<U>, E>;
fn ready_try_fold<U, F>(
self,
init: U,
f: F,
) -> TryFold<Self, Ready<Result<U, E>>, U, impl FnMut(U, S::Ok) -> Ready<Result<U, E>>> ⓘ
where F: Fn(U, S::Ok) -> Result<U, E>;
fn ready_try_fold_default<U, F>(
self,
f: F,
) -> TryFold<Self, Ready<Result<U, E>>, U, impl FnMut(U, S::Ok) -> Ready<Result<U, E>>> ⓘ
where F: Fn(U, S::Ok) -> Result<U, E>,
U: Default;
fn ready_try_for_each<F>(
self,
f: F,
) -> TryForEach<Self, Ready<Result<(), E>>, impl FnMut(S::Ok) -> Ready<Result<(), E>>> ⓘ
where F: FnMut(S::Ok) -> Result<(), E>;
fn ready_try_skip_while<F>(
self,
f: F,
) -> TrySkipWhile<Self, Ready<Result<bool, E>>, impl FnMut(&S::Ok) -> Ready<Result<bool, E>>>
where F: Fn(&S::Ok) -> Result<bool, E>;
fn ready_try_take_while<F>(
self,
f: F,
) -> TryTakeWhile<Self, Ready<Result<bool, E>>, impl FnMut(&S::Ok) -> Ready<Result<bool, E>>>
where F: Fn(&S::Ok) -> Result<bool, E>;
}Expand description
Adds synchronous combinators to fallible streams.
Closures run immediately when a successful item is polled, avoiding an async block around non-async work. Source errors retain the stream’s error type.
Required Methods§
Sourcefn ready_and_then<U, F>(
self,
f: F,
) -> AndThen<Self, Ready<Result<U, E>>, impl FnMut(S::Ok) -> Ready<Result<U, E>>>
fn ready_and_then<U, F>( self, f: F, ) -> AndThen<Self, Ready<Result<U, E>>, impl FnMut(S::Ok) -> Ready<Result<U, E>>>
Applies a synchronous fallible transform to successful items.
Existing source errors bypass f. Successful transformed values and
closure errors remain in source order.
Sourcefn ready_try_filter<F>(
self,
f: F,
) -> TryFilter<Self, Ready<bool>, impl FnMut(&S::Ok) -> Ready<bool>>
fn ready_try_filter<F>( self, f: F, ) -> TryFilter<Self, Ready<bool>, impl FnMut(&S::Ok) -> Ready<bool>>
Retains successful items accepted by a synchronous predicate.
The predicate borrows only successful values. Source errors pass through without invoking it.
Sourcefn ready_try_filter_map<F, U>(
self,
f: F,
) -> TryFilterMap<Self, Ready<Result<Option<U>, E>>, impl FnMut(S::Ok) -> Ready<Result<Option<U>, E>>>
fn ready_try_filter_map<F, U>( self, f: F, ) -> TryFilterMap<Self, Ready<Result<Option<U>, E>>, impl FnMut(S::Ok) -> Ready<Result<Option<U>, E>>>
Maps successful items through a synchronous fallible filter.
Ok(Some(value)) yields a value and Ok(None) discards the item.
Source errors and closure errors remain in the result stream.
Sourcefn ready_try_fold<U, F>(
self,
init: U,
f: F,
) -> TryFold<Self, Ready<Result<U, E>>, U, impl FnMut(U, S::Ok) -> Ready<Result<U, E>>> ⓘ
fn ready_try_fold<U, F>( self, init: U, f: F, ) -> TryFold<Self, Ready<Result<U, E>>, U, impl FnMut(U, S::Ok) -> Ready<Result<U, E>>> ⓘ
Folds successful items with a synchronous fallible accumulator.
Folding begins from init and processes values in source order. A
source or closure error ends the returned future with that error.
Sourcefn ready_try_fold_default<U, F>(
self,
f: F,
) -> TryFold<Self, Ready<Result<U, E>>, U, impl FnMut(U, S::Ok) -> Ready<Result<U, E>>> ⓘ
fn ready_try_fold_default<U, F>( self, f: F, ) -> TryFold<Self, Ready<Result<U, E>>, U, impl FnMut(U, S::Ok) -> Ready<Result<U, E>>> ⓘ
Folds successful items from U::default() with a fallible accumulator.
Values are processed in source order. An empty stream returns the default, while a source or closure error ends the fold.
Sourcefn ready_try_for_each<F>(
self,
f: F,
) -> TryForEach<Self, Ready<Result<(), E>>, impl FnMut(S::Ok) -> Ready<Result<(), E>>> ⓘ
fn ready_try_for_each<F>( self, f: F, ) -> TryForEach<Self, Ready<Result<(), E>>, impl FnMut(S::Ok) -> Ready<Result<(), E>>> ⓘ
Applies a synchronous fallible closure to each successful item.
Values are processed in source order. A source or closure error ends the returned future before later items are visited.
Sourcefn ready_try_skip_while<F>(
self,
f: F,
) -> TrySkipWhile<Self, Ready<Result<bool, E>>, impl FnMut(&S::Ok) -> Ready<Result<bool, E>>>
fn ready_try_skip_while<F>( self, f: F, ) -> TrySkipWhile<Self, Ready<Result<bool, E>>, impl FnMut(&S::Ok) -> Ready<Result<bool, E>>>
Skips leading successful items accepted by a fallible predicate.
The first false item and later items are yielded without further predicate calls. Source and predicate errors remain in the result stream.
Sourcefn ready_try_take_while<F>(
self,
f: F,
) -> TryTakeWhile<Self, Ready<Result<bool, E>>, impl FnMut(&S::Ok) -> Ready<Result<bool, E>>>
fn ready_try_take_while<F>( self, f: F, ) -> TryTakeWhile<Self, Ready<Result<bool, E>>, impl FnMut(&S::Ok) -> Ready<Result<bool, E>>>
Yields leading successful items accepted by a fallible predicate.
The first false item ends the stream and is not yielded. Source and predicate errors are yielded without terminating the adapter, and a predicate error discards the tested item.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".