Skip to main content

CancelProgress

Struct CancelProgress 

Source
pub struct CancelProgress<'a> { /* private fields */ }
Expand description

ProgressSink that stops forwarding once Cancel or ProgressSink::should_cancel fires.

Long checkout loops call Self::finish_poll after apply so callers get crate::error::Error::Cancelled even when cancellation happened on an ProgressSink::inc boundary.

Implementations§

Source§

impl<'a> CancelProgress<'a>

Source

pub fn new(inner: &'a mut dyn ProgressSink, cancel: &'a dyn Cancel) -> Self

Wrap inner so every progress update observes cancel.

Source

pub fn stopped(&self) -> bool

Whether a cancel signal was observed.

Source

pub fn finish_poll(&self) -> Result<()>

Trait Implementations§

Source§

impl ProgressSink for CancelProgress<'_>

Source§

fn start(&mut self, phase: ProgressPhase, total: Option<u64>)

Begin a new progress phase, optionally with a known total count of ProgressPhase::default_unit units for that phase. Read more
Source§

fn start_with_unit( &mut self, phase: ProgressPhase, unit: ProgressUnit, total: Option<u64>, )

Begin a phase with an explicit count unit (for example ProgressUnit::Bytes when streaming a pack whose size is known in bytes). Read more
Source§

fn inc(&mut self, units: u64)

Advance the current phase by units in the active phase unit.
Source§

fn set(&mut self, current: u64)

Set the absolute progress of the current phase to current units.
Source§

fn finish(&mut self)

Finish the current phase.
Source§

fn should_cancel(&self) -> bool

When true, the operation should stop at the next poll_cancel check. Read more

Auto Trait Implementations§

§

impl<'a> !Freeze for CancelProgress<'a>

§

impl<'a> !RefUnwindSafe for CancelProgress<'a>

§

impl<'a> !Send for CancelProgress<'a>

§

impl<'a> !Sync for CancelProgress<'a>

§

impl<'a> !UnwindSafe for CancelProgress<'a>

§

impl<'a> Unpin for CancelProgress<'a>

§

impl<'a> UnsafeUnpin for CancelProgress<'a>

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> Same for T

Source§

type Output = T

Should always be Self
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.