pub enum InjectionStrategy {
Never,
AtSequence(u64),
AtPoint(AwaitPoint),
EveryNth(u64),
AllPoints,
RandomSample(usize),
SpecificPoints(Vec<u64>),
FirstN(usize),
Probabilistic(f64),
WindowAround {
center: u64,
radius: u64,
},
ExceptFirst(usize),
LastN(usize),
}Expand description
Strategy for selecting which await points to inject cancellation at.
This controls which points are selected for injection during a test run.
Use with InjectionRunner::run_with_injection for automated test execution.
Variants§
Never
Never inject cancellation (recording mode only).
AtSequence(u64)
Inject at a specific await point sequence number.
AtPoint(AwaitPoint)
Inject at a specific await point.
EveryNth(u64)
Inject at every Nth await point.
AllPoints
Test every await point (most thorough, N+1 runs for N await points).
RandomSample(usize)
Test n randomly-selected await points using deterministic RNG.
SpecificPoints(Vec<u64>)
Test only specified await points.
FirstN(usize)
Test first n await points.
Probabilistic(f64)
Each await point has probability p (0.0-1.0) of injection.
WindowAround
Test a window of points around a center point.
Selects all recorded points in [center - radius, center + radius].
Useful for targeting a specific code region (e.g., around a known
cancel checkpoint) without testing every point in the entire run.
Fields
ExceptFirst(usize)
Skip the first N points, test the rest.
Useful for bypassing initialization and focusing on steady-state or cleanup/finalization phases where cancellation handling matters most.
LastN(usize)
Test only the last N recorded await points.
Targets the tail of execution — typically the finalization and cleanup phases — where cancel-correctness bugs are most common.
Implementations§
Source§impl InjectionStrategy
impl InjectionStrategy
Trait Implementations§
Source§impl Clone for InjectionStrategy
impl Clone for InjectionStrategy
Source§fn clone(&self) -> InjectionStrategy
fn clone(&self) -> InjectionStrategy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InjectionStrategy
impl Debug for InjectionStrategy
Source§impl Default for InjectionStrategy
impl Default for InjectionStrategy
Source§fn default() -> InjectionStrategy
fn default() -> InjectionStrategy
Auto Trait Implementations§
impl Freeze for InjectionStrategy
impl RefUnwindSafe for InjectionStrategy
impl Send for InjectionStrategy
impl Sync for InjectionStrategy
impl Unpin for InjectionStrategy
impl UnsafeUnpin for InjectionStrategy
impl UnwindSafe for InjectionStrategy
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more