pub struct PhaseGuard { /* private fields */ }Expand description
RAII scope guard for the ACTIVE_PHASE thread-local. Install
at scenario-driver run_step entry; the guard’s Drop restores
the prior phase label, supporting cleanly-nested scenario
dispatch (sub-scenarios layer over a parent’s phase context
without leaking).
let _guard = PhaseGuard::install_step(0); // Step[0] → "Step[0]"
// ... apply_ops + hold, every assert constructed here stamps
// phase = Some("Step[0]") automatically ...
// drop on scope exit restores the prior label (BASELINE outside
// any nested Step).Implementations§
Source§impl PhaseGuard
impl PhaseGuard
Sourcepub fn install(label: impl Into<Cow<'static, str>>) -> Self
pub fn install(label: impl Into<Cow<'static, str>>) -> Self
Install label as the active phase. Captures the
previously-active label for restoration on Drop. Use
Self::install_step / Self::install_baseline for the
scenario-driver call sites — they produce the standard
"Step[k]" / "BASELINE" labels matching the rest of the
pipeline.
Sourcepub fn install_step(zero_indexed: u16) -> Self
pub fn install_step(zero_indexed: u16) -> Self
Convenience: install the "Step[k]" label for the
zero_indexed-th scenario Step. Matches the label
PhaseBucket embeds + the Phase::step display
(Step[0], Step[1], …).
Sourcepub fn install_baseline() -> Self
pub fn install_baseline() -> Self
Convenience: install the "BASELINE" label for the
pre-first-Step settle window. Matches the label
PhaseBucket uses for step_index = 0.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PhaseGuard
impl RefUnwindSafe for PhaseGuard
impl Send for PhaseGuard
impl Sync for PhaseGuard
impl Unpin for PhaseGuard
impl UnwindSafe for PhaseGuard
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<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