Struct Task
pub struct Task<T> { /* private fields */ }Expand description
A set of concurrent actions to be performed by the iced runtime.
A Task may produce a bunch of values of type T.
Implementations§
§impl<T> Task<T>
impl<T> Task<T>
pub 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.
pub fn perform<A>(
future: impl Future<Output = A> + MaybeSend + 'static,
f: impl FnOnce(A) -> T + MaybeSend + 'static,
) -> Task<T>where
T: MaybeSend + 'static,
A: MaybeSend + 'static,
pub fn perform<A>(
future: impl Future<Output = A> + MaybeSend + 'static,
f: impl FnOnce(A) -> T + MaybeSend + 'static,
) -> Task<T>where
T: MaybeSend + 'static,
A: MaybeSend + 'static,
pub 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,
Creates a Task that runs the given [Stream] to completion and maps each
item with the given closure.
pub fn sip<S>(
sipper: S,
on_progress: impl FnMut(<S as Core>::Progress) -> T + MaybeSend + 'static,
on_output: impl FnOnce(<S as Future>::Output) -> T + MaybeSend + 'static,
) -> Task<T>where
S: Core + MaybeSend + 'static,
T: MaybeSend + 'static,
pub fn sip<S>(
sipper: S,
on_progress: impl FnMut(<S as Core>::Progress) -> T + MaybeSend + 'static,
on_output: impl FnOnce(<S as Future>::Output) -> T + MaybeSend + 'static,
) -> Task<T>where
S: Core + MaybeSend + 'static,
T: MaybeSend + 'static,
pub 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.
pub fn map<O>(self, f: impl FnMut(T) -> O + MaybeSend + 'static) -> Task<O>where
T: MaybeSend + 'static,
O: MaybeSend + 'static,
pub fn map<O>(self, f: impl FnMut(T) -> O + MaybeSend + 'static) -> Task<O>where
T: MaybeSend + 'static,
O: MaybeSend + 'static,
Maps the output of a Task with the given closure.
pub fn then<O>(
self,
f: impl FnMut(T) -> Task<O> + MaybeSend + 'static,
) -> Task<O>where
T: MaybeSend + 'static,
O: MaybeSend + 'static,
pub fn then<O>(
self,
f: impl FnMut(T) -> Task<O> + MaybeSend + 'static,
) -> Task<O>where
T: MaybeSend + 'static,
O: MaybeSend + 'static,
pub 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.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Task<T>
impl<T> !RefUnwindSafe for Task<T>
impl<T> Send for Task<T>
impl<T> !Sync for Task<T>
impl<T> Unpin for Task<T>
impl<T> !UnwindSafe for Task<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Turns some type into the initial state of some
Application.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().