Struct ProgressToken

Source
pub struct ProgressToken<S> { /* private fields */ }
Expand description

A token that tracks the progress of a task and can be organized hierarchically

Implementations§

Source§

impl<S: Clone + Send + 'static> ProgressToken<S>

Source

pub fn new(status: impl Into<S>) -> Self

Create a new root ProgressToken

Source

pub fn child(&self, weight: f64, status: impl Into<S>) -> Self

Create a child token

Source

pub fn update_progress(&self, progress: f64)

Update the progress of this token

Source

pub fn update_indeterminate(&self)

Set the progress state to indeterminate

Source

pub fn update_status(&self, status: impl Into<S>)

Update the status message

Source

pub fn update(&self, progress: Progress, status: impl Into<S>)

Update the progress and status message

Source

pub fn complete(&self)

Mark the task as complete

Source

pub fn check(&self) -> Result<(), ProgressError>

Returns ProgressError::Cancelled if the token is cancelled, otherwise Ok.

Source

pub fn is_cancelled(&self) -> bool

Source

pub fn cancel(&self)

Cancel this task and all its children

Source

pub fn state(&self) -> Progress

Get the current progress state asynchronously

Source

pub fn statuses(&self) -> Vec<S>

Get all status messages in this hierarchy asynchronously

Source

pub fn cancelled(&self) -> WaitForCancellationFuture<'_>

Source

pub fn cancelled_owned(self) -> WaitForCancellationFutureOwned

Source

pub async fn updated(&self) -> Result<ProgressUpdate<S>, ProgressError>

Source

pub fn subscribe(&self) -> ProgressStream<'_, S>

Subscribe to progress updates from this token

Source

pub fn complete_guard(&self) -> CompleteGuard<'_, S>

Creates a guard that will automatically mark this token as complete when dropped

Trait Implementations§

Source§

impl<S: Clone> Clone for ProgressToken<S>

Source§

fn clone(&self) -> ProgressToken<S>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S: Debug> Debug for ProgressToken<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S: Default + Clone + Send + 'static> Default for ProgressToken<S>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<S> Freeze for ProgressToken<S>

§

impl<S> RefUnwindSafe for ProgressToken<S>

§

impl<S> Send for ProgressToken<S>
where S: Send,

§

impl<S> Sync for ProgressToken<S>
where S: Send,

§

impl<S> Unpin for ProgressToken<S>

§

impl<S> UnwindSafe for ProgressToken<S>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.