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>
impl<'a> CancelProgress<'a>
Sourcepub fn new(inner: &'a mut dyn ProgressSink, cancel: &'a dyn Cancel) -> Self
pub fn new(inner: &'a mut dyn ProgressSink, cancel: &'a dyn Cancel) -> Self
Wrap inner so every progress update observes cancel.
Sourcepub fn finish_poll(&self) -> Result<()>
pub fn finish_poll(&self) -> Result<()>
Returns crate::error::Error::Cancelled when Self::stopped.
Trait Implementations§
Source§impl ProgressSink for CancelProgress<'_>
impl ProgressSink for CancelProgress<'_>
Source§fn start(&mut self, phase: ProgressPhase, total: Option<u64>)
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 moreSource§fn start_with_unit(
&mut self,
phase: ProgressPhase,
unit: ProgressUnit,
total: Option<u64>,
)
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 moreSource§fn set(&mut self, current: u64)
fn set(&mut self, current: u64)
Set the absolute progress of the current phase to
current units.Source§fn should_cancel(&self) -> bool
fn should_cancel(&self) -> bool
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> 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