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) -> Self
pub fn new(inner: &'a dyn Pulse, stop: impl Stop + 'static) -> Self
Check the inner policy, then stop. Both remain attached to descendants.
Sourcepub fn borrowed(inner: &'a dyn Pulse, stop: &'a dyn Stop) -> Self
pub fn borrowed(inner: &'a dyn Pulse, stop: &'a dyn Stop) -> Self
Combine policies without owning or allocating the additional stop source.
Sourcepub fn replacing(inner: &'a dyn Pulse, stop: impl Stop + 'static) -> Self
pub fn replacing(inner: &'a dyn Pulse, stop: impl Stop + 'static) -> Self
Use only stop for checkpoints, bypassing the inner stop and callbacks.
Sourcepub fn replacing_borrowed(inner: &'a dyn Pulse, stop: &'a dyn Stop) -> Self
pub fn replacing_borrowed(inner: &'a dyn Pulse, stop: &'a dyn Stop) -> Self
Replace checkpoints with a borrowed policy; see Self::replacing.