pub trait MaybeFuture: IntoFuture + Sendwhere
Self::IntoFuture: Send,{
// Required method
fn wait(self) -> Self::Output;
// Provided methods
fn map<T, R>(self, f: T) -> Map<Self, T>
where T: FnOnce(Self::Output) -> R + Unpin + Send,
Self: Sized { ... }
fn map_ok<C, T, U, E>(self, c: C) -> impl MaybeFuture
where Self: MaybeFuture<Output = Result<T, E>> + Sized,
C: FnOnce(T) -> U + Unpin + Send { ... }
fn map_err<C, T, E, F>(self, c: C) -> impl MaybeFuture
where Self: MaybeFuture<Output = Result<T, E>> + Sized,
C: FnOnce(E) -> F + Unpin + Send { ... }
}Expand description
IO that may be performed synchronously or asynchronously.
A MaybeFuture can be run asynchronously with .await, or
run synchronously (blocking the current thread) with .wait().
Required Methods§
Provided Methods§
Sourcefn map_ok<C, T, U, E>(self, c: C) -> impl MaybeFuture
fn map_ok<C, T, U, E>(self, c: C) -> impl MaybeFuture
Maps the output’s success value to a different value.
Sourcefn map_err<C, T, E, F>(self, c: C) -> impl MaybeFuture
fn map_err<C, T, E, F>(self, c: C) -> impl MaybeFuture
Maps the output’s error value to a different value.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".