Introduce explicit image::allocate API
This commit is contained in:
parent
6fa54f7f6b
commit
23039e758e
15 changed files with 355 additions and 51 deletions
|
|
@ -379,14 +379,16 @@ impl<T, E> Task<Result<T, E>> {
|
|||
/// The success value is provided to the closure to create the subsequent [`Task`].
|
||||
pub fn and_then<A>(
|
||||
self,
|
||||
f: impl Fn(T) -> Task<A> + MaybeSend + 'static,
|
||||
) -> Task<A>
|
||||
f: impl Fn(T) -> Task<Result<A, E>> + MaybeSend + 'static,
|
||||
) -> Task<Result<A, E>>
|
||||
where
|
||||
T: MaybeSend + 'static,
|
||||
E: MaybeSend + 'static,
|
||||
A: MaybeSend + 'static,
|
||||
{
|
||||
self.then(move |option| option.map_or_else(|_| Task::none(), &f))
|
||||
self.then(move |result| {
|
||||
result.map_or_else(|error| Task::done(Err(error)), &f)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue