Skip to main content

TaskList

Struct TaskList 

Source
pub struct TaskList<'a, Msg> { /* private fields */ }
Expand description

Shows a Tasks model as rows built from existing widgets.

A running task shows a Spinner, its label, its latest note and, when it reports a fraction, a ProgressBar. A finished task shows a status icon with a word: a success check with done, a danger cross with the failure reason, a muted dash with cancelled. Columns line up across rows. With no tasks it shows the empty text in faint type.

Plain by default; on_cancel adds a cancel button to running rows. Words come from quvyta.tasks.done, quvyta.tasks.cancelled, quvyta.tasks.cancel and quvyta.tasks.empty; icons success, error and check-partial.

Implementations§

Source§

impl<'a, Msg: Clone + 'static> TaskList<'a, Msg>

Source

pub fn new(tasks: &'a Tasks) -> Self

Rows for tasks.

Source

pub fn empty_text(self, text: impl Into<String>) -> Self

Text shown when there are no tasks, instead of quvyta.tasks.empty.

Source

pub fn on_cancel(self, message: impl Fn(TaskId) -> Msg + 'a) -> Self

Adds a cancel button to every running task; the message usually returns Command::cancel_task.

Source

pub fn show<'v>(self, ui: &'v mut View<'_, Msg>) -> NodeMut<'v, Msg>

Adds the rows to ui as one column.

Auto Trait Implementations§

§

impl<'a, Msg> !RefUnwindSafe for TaskList<'a, Msg>

§

impl<'a, Msg> !Send for TaskList<'a, Msg>

§

impl<'a, Msg> !Sync for TaskList<'a, Msg>

§

impl<'a, Msg> !UnwindSafe for TaskList<'a, Msg>

§

impl<'a, Msg> Freeze for TaskList<'a, Msg>
where Option<Box<dyn Fn(TaskId) -> Msg + 'a>>: Freeze,

§

impl<'a, Msg> Unpin for TaskList<'a, Msg>
where Option<Box<dyn Fn(TaskId) -> Msg + 'a>>: Unpin,

§

impl<'a, Msg> UnsafeUnpin for TaskList<'a, Msg>
where Option<Box<dyn Fn(TaskId) -> Msg + 'a>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.