pub struct ConfigValueGuard<'a, T: 'static> { /* private fields */ }Expand description
A guard that restores a single configuration value when dropped
Trait Implementations§
Source§impl<T: 'static> Drop for ConfigValueGuard<'_, T>
When a ConfigValueGuard is dropped, it restores configuration
state for the key it was guarding.
impl<T: 'static> Drop for ConfigValueGuard<'_, T>
When a ConfigValueGuard is dropped, it restores configuration
state for the key it was guarding.
Behavior:
- Each key maintains a stack of override frames. The most recent
frame (top of stack) defines the effective value in
Source::TestOverride. - Dropping a guard removes its frame. If it was the top frame, the next frame (if any) becomes active and both the config and mirrored env var are updated accordingly.
- If the dropped frame was not on top, no changes occur until the active frame is dropped.
- When the last frame for a key is removed, the key is deleted from the TestOverride layer and its associated environment variable (if any) is restored to its original value or removed if it did not exist.
This guarantees that nested or out-of-order test overrides are restored deterministically and without leaking state into subsequent tests.
Auto Trait Implementations§
impl<'a, T> Freeze for ConfigValueGuard<'a, T>
impl<'a, T> !RefUnwindSafe for ConfigValueGuard<'a, T>
impl<'a, T> Send for ConfigValueGuard<'a, T>where
T: Sync,
impl<'a, T> Sync for ConfigValueGuard<'a, T>where
T: Sync,
impl<'a, T> Unpin for ConfigValueGuard<'a, T>
impl<'a, T> !UnwindSafe for ConfigValueGuard<'a, T>
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
Mutably borrows from an owned value. Read more
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<A, M> Handler<IndexedErasedUnbound<M>> for A
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
§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>
Converts
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>
Converts
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