pub trait ActorTryFutureExt<A: Actor>: ActorTryFuture<A> {
// Provided methods
fn and_then<Fut, F>(self, f: F) -> AndThen<Self, Fut, F>
where F: FnOnce(Self::Ok, &mut A, &mut A::Context) -> Fut,
Fut: ActorTryFuture<A, Error = Self::Error>,
Self: Sized { ... }
fn map_ok<T, F>(self, f: F) -> MapOk<Self, F>
where F: FnOnce(Self::Ok, &mut A, &mut A::Context) -> T,
Self: Sized { ... }
fn map_err<T, F>(self, f: F) -> MapErr<Self, F>
where F: FnOnce(Self::Error, &mut A, &mut A::Context) -> T,
Self: Sized { ... }
}
Expand description
Adapters specific to Result
-returning actor futures
Provided Methods§
Sourcefn and_then<Fut, F>(self, f: F) -> AndThen<Self, Fut, F>
fn and_then<Fut, F>(self, f: F) -> AndThen<Self, Fut, F>
Executes another actor future after this one resolves successfully. The success value is passed to a closure to create this subsequent actor future.
The provided closure f
will only be called if this actor future is
resolved to an Ok
. If this actor future resolves to an Err
,
panics, or is dropped, then the provided closure will never
be invoked. The Error
type of
this actor future and the actor future returned by f
have to match.
Note that this method consumes the actor future it is called on and returns a wrapped version of it.
Sourcefn map_ok<T, F>(self, f: F) -> MapOk<Self, F>
fn map_ok<T, F>(self, f: F) -> MapOk<Self, F>
Maps this actor future’s success value to a different value.
This method can be used to change the Ok
type
of the actor future into a different type. It is similar to the
Result::map
method. You can use this method to chain along a
computation once the actor future has been resolved.
The provided closure f
will only be called if this actor future is
resolved to an Ok
. If it resolves to an Err
, panics, or is
dropped, then the provided closure will never be invoked.
Note that this method consumes the actor future it is called on and returns a wrapped version of it.
Sourcefn map_err<T, F>(self, f: F) -> MapErr<Self, F>
fn map_err<T, F>(self, f: F) -> MapErr<Self, F>
Maps this actor future’s error value to a different value.
This method can be used to change the Error
type of the actor future into a different type. It is similar to the
Result::map_err
method.
The provided closure f
will only be called if this actor future is
resolved to an Err
. If it resolves to an Ok
, panics, or is
dropped, then the provided closure will never be invoked.
Note that this method consumes the actor future it is called on and returns a wrapped version of it.