pub trait FutureExt<T>: Sized {
// Required methods
fn map<U>(self, f: impl FnOnce(T) -> U + Send + 'static) -> AsyncTask<U> ⓘ
where U: Send + 'static + NotResult;
fn on_ok<U>(self, f: impl FnOnce(T) -> U + Send + 'static) -> AsyncTask<U> ⓘ
where U: Send + 'static + NotResult;
fn on_error<U>(
self,
f: impl FnOnce(RecvError) -> U + Send + 'static,
) -> AsyncTask<U> ⓘ
where U: Send + 'static + NotResult,
T: Into<U>;
fn on_result<U>(
self,
f: impl FnOnce(Result<T, RecvError>) -> U + Send + 'static,
) -> AsyncTask<U> ⓘ
where U: Send + 'static + NotResult;
fn map_ok<U>(self, f: impl FnOnce(T) -> U + Send + 'static) -> AsyncTask<U> ⓘ
where U: Send + 'static + NotResult;
fn tap_ok(self, f: impl FnOnce(&T) + Send + 'static) -> AsyncTask<T> ⓘ
where T: NotResult;
fn tap_err(
self,
f: impl FnOnce(&RecvError) + Send + 'static,
) -> AsyncTask<T> ⓘ
where T: NotResult;
}Expand description
Extension trait for futures that provides additional combinators for async operations.
Required Methods§
Sourcefn map<U>(self, f: impl FnOnce(T) -> U + Send + 'static) -> AsyncTask<U> ⓘ
fn map<U>(self, f: impl FnOnce(T) -> U + Send + 'static) -> AsyncTask<U> ⓘ
Maps the success value of the future to a new type using the provided function.
Sourcefn on_ok<U>(self, f: impl FnOnce(T) -> U + Send + 'static) -> AsyncTask<U> ⓘ
fn on_ok<U>(self, f: impl FnOnce(T) -> U + Send + 'static) -> AsyncTask<U> ⓘ
Executes a function when the future completes successfully.
Sourcefn on_error<U>(
self,
f: impl FnOnce(RecvError) -> U + Send + 'static,
) -> AsyncTask<U> ⓘ
fn on_error<U>( self, f: impl FnOnce(RecvError) -> U + Send + 'static, ) -> AsyncTask<U> ⓘ
Executes a function when the future encounters an error.
Sourcefn on_result<U>(
self,
f: impl FnOnce(Result<T, RecvError>) -> U + Send + 'static,
) -> AsyncTask<U> ⓘ
fn on_result<U>( self, f: impl FnOnce(Result<T, RecvError>) -> U + Send + 'static, ) -> AsyncTask<U> ⓘ
Handles both success and error cases with a result handler.
Sourcefn map_ok<U>(self, f: impl FnOnce(T) -> U + Send + 'static) -> AsyncTask<U> ⓘ
fn map_ok<U>(self, f: impl FnOnce(T) -> U + Send + 'static) -> AsyncTask<U> ⓘ
Maps the success value while preserving error 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.