Skip to main content

WithStop

Struct WithStop 

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

Adds or replaces a pulse’s checkpoint policy, including through descendants.

Borrowed policies need no allocation and accept a local &dyn Stop. They cannot outlive that borrow: Pulse::share returns PlanError::NotShareable. Use an owned policy with Self::new or Self::replacing for spawned workers. Scoped workers can borrow this adapter directly.

Replacement bypasses the inner check entirely, including its callbacks. Reporting, planning, ownership and completion still reach the inner pulse. Combining is usually appropriate when adding a library-local cancellation source.

Implementations§

Source§

impl<'a> WithStop<'a>

Source

pub fn new(inner: &'a dyn Pulse, stop: impl Stop + 'static) -> WithStop<'a>

Check the inner policy, then stop. Both remain attached to descendants.

Source

pub fn borrowed(inner: &'a dyn Pulse, stop: &'a dyn Stop) -> WithStop<'a>

Combine policies without owning or allocating the additional stop source.

Source

pub fn replacing( inner: &'a dyn Pulse, stop: impl Stop + 'static, ) -> WithStop<'a>

Use only stop for checkpoints, bypassing the inner stop and callbacks.

Source

pub fn replacing_borrowed( inner: &'a dyn Pulse, stop: &'a dyn Stop, ) -> WithStop<'a>

Replace checkpoints with a borrowed policy; see Self::replacing.

Trait Implementations§

Source§

impl ChildPulse for WithStop<'_>

Source§

fn complete_inferred(self: Box<WithStop<'_>>, outcome: Outcome)

Resolve an untouched phase from its enclosing result. The default uses ordinary completion; trackers can retain the inference as evidence.
Source§

fn complete_as(self: Box<WithStop<'_>>, outcome: Outcome)

Complete best-effort observation. Trackers may infer untouched descendants from this result; the default preserves older implementors’ finish logic.
Source§

fn finish(self: Box<WithStop<'_>>, outcome: Outcome) -> Result<(), PlanError>

Publish this child’s terminal outcome.
Source§

impl Pulse for WithStop<'_>

Source§

fn record_issue(&self, error: PlanError)

Record a reporting-protocol problem for optional diagnostics. This never changes cancellation or the operation’s return value. Ordinary sinks may ignore it; diagnostic wrappers retain bounded evidence.
Source§

fn split( &self, e: Execution, parts: &[PhaseSpec<'_>], ) -> Result<Vec<Child<'_>>, PlanError>

Split this phase into weighted children, in declared order. Read more
Source§

fn share(&self) -> Result<SharedPulse, PlanError>

Share all pulse capabilities with owned work, but never completion rights. Read more
Source§

fn start(&self) -> Result<(), PlanError>

Mark this phase running, without counting or ending planning. Implementations without lifecycle observations may ignore this.
Source§

fn set_total(&self, total: Total) -> Result<(), PlanError>

Revise a leaf’s denominator without changing completed units or weights. Unsupported implementations return an error instead of losing the update.
Source§

impl Report for WithStop<'_>

Source§

fn advance(&self, n: u64)

Add completed finished units.
Source§

fn may_report(&self) -> bool

Whether reports have any effect. Read more
Source§

impl Stop for WithStop<'_>

Source§

fn check(&self) -> Result<(), StopReason>

Check if the operation should stop. Read more
Source§

fn may_stop(&self) -> bool

Returns true if this stop can ever signal a stop. Read more
Source§

fn should_stop(&self) -> bool

Returns true if the operation should stop. Read more

Auto Trait Implementations§

§

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

§

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

§

impl<'a> Freeze for WithStop<'a>

§

impl<'a> Send for WithStop<'a>

§

impl<'a> Sync for WithStop<'a>

§

impl<'a> Unpin for WithStop<'a>

§

impl<'a> UnsafeUnpin for WithStop<'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> ProgressExt for T
where T: Stop + Report + ?Sized,

Source§

fn step(&self, completed: u64) -> Result<(), StopReason>

Count completed finished units, then check for cancellation. Read more
Source§

fn live(&self) -> Option<&Self>

The live pulse: this value, or None when it can neither stop nor report. Read more
Source§

fn split_array<const N: usize>( &self, execution: Execution, parts: [PhaseSpec<'_>; N], ) -> Result<[Child<'_>; N], PlanError>
where Self: Pulse,

Pulse::split into exactly N children, returned as an array. Read more
Source§

impl<T> ReportExt for T
where T: Report + ?Sized,

Source§

fn batched(self, threshold: NonZeroU64) -> Batch<Self>
where Self: Sized,

Buffer one worker’s reports, publishing them in batches of at least threshold units, and the remainder on Batch::flush or drop. 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.