pub type Task<M> = Task<Action<M>>;
Aliased Type§
struct Task<M>(/* private fields */);
Implementations
Source§impl<T> Task<T>
impl<T> Task<T>
Sourcepub fn done(value: T) -> Task<T>where
T: MaybeSend + 'static,
pub fn done(value: T) -> Task<T>where
T: MaybeSend + 'static,
Creates a new Task
that instantly produces the given value.
Sourcepub fn perform<A>(
future: impl Future<Output = A> + MaybeSend + 'static,
f: impl Fn(A) -> T + MaybeSend + 'static,
) -> Task<T>
pub fn perform<A>( future: impl Future<Output = A> + MaybeSend + 'static, f: impl Fn(A) -> T + MaybeSend + 'static, ) -> Task<T>
Sourcepub fn run<A>(
stream: impl Stream<Item = A> + MaybeSend + 'static,
f: impl Fn(A) -> T + MaybeSend + 'static,
) -> Task<T>where
T: 'static,
pub fn run<A>(
stream: impl Stream<Item = A> + MaybeSend + 'static,
f: impl Fn(A) -> T + MaybeSend + 'static,
) -> Task<T>where
T: 'static,
Sourcepub fn batch(tasks: impl IntoIterator<Item = Task<T>>) -> Task<T>where
T: 'static,
pub fn batch(tasks: impl IntoIterator<Item = Task<T>>) -> Task<T>where
T: 'static,
Combines the given tasks and produces a single Task
that will run all of them
in parallel.
Sourcepub fn map<O>(self, f: impl FnMut(T) -> O + MaybeSend + 'static) -> Task<O>
pub fn map<O>(self, f: impl FnMut(T) -> O + MaybeSend + 'static) -> Task<O>
Maps the output of a Task
with the given closure.
Sourcepub fn chain(self, task: Task<T>) -> Task<T>where
T: 'static,
pub fn chain(self, task: Task<T>) -> Task<T>where
T: 'static,
Chains a new Task
to be performed once the current one finishes completely.