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>
impl<'a> WithStop<'a>
Sourcepub fn new(inner: &'a dyn Pulse, stop: impl Stop + 'static) -> WithStop<'a>
pub fn new(inner: &'a dyn Pulse, stop: impl Stop + 'static) -> WithStop<'a>
Check the inner policy, then stop. Both remain attached to descendants.
Sourcepub fn borrowed(inner: &'a dyn Pulse, stop: &'a dyn Stop) -> WithStop<'a>
pub fn borrowed(inner: &'a dyn Pulse, stop: &'a dyn Stop) -> WithStop<'a>
Combine policies without owning or allocating the additional stop source.
Sourcepub fn replacing(
inner: &'a dyn Pulse,
stop: impl Stop + 'static,
) -> WithStop<'a>
pub fn replacing( inner: &'a dyn Pulse, stop: impl Stop + 'static, ) -> WithStop<'a>
Use only stop for checkpoints, bypassing the inner stop and callbacks.
Sourcepub fn replacing_borrowed(
inner: &'a dyn Pulse,
stop: &'a dyn Stop,
) -> WithStop<'a>
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<'_>
impl ChildPulse for WithStop<'_>
Source§fn complete_inferred(self: Box<WithStop<'_>>, outcome: Outcome)
fn complete_inferred(self: Box<WithStop<'_>>, outcome: Outcome)
Source§impl Pulse for WithStop<'_>
impl Pulse for WithStop<'_>
Source§fn record_issue(&self, error: PlanError)
fn record_issue(&self, error: PlanError)
Source§fn split(
&self,
e: Execution,
parts: &[PhaseSpec<'_>],
) -> Result<Vec<Child<'_>>, PlanError>
fn split( &self, e: Execution, parts: &[PhaseSpec<'_>], ) -> Result<Vec<Child<'_>>, PlanError>
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> 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
Source§impl<T> ProgressExt for T
impl<T> ProgressExt for T
Source§impl<T> ReportExt for T
impl<T> ReportExt for T
Source§fn batched(self, threshold: NonZeroU64) -> Batch<Self>where
Self: Sized,
fn batched(self, threshold: NonZeroU64) -> Batch<Self>where
Self: Sized,
threshold units, and the remainder on Batch::flush or drop. Read more