Skip to main content

ScopeGuard

Struct ScopeGuard 

Source
pub struct ScopeGuard { /* private fields */ }
Expand description

RAII guard returned by obs::scope! and obs::context!. Dropping pops the frame; for Scope kind frames where any >= ERROR envelope was observed, the tail buffer is flushed back through the active observer with sampling_reason = TAIL_ERROR.

Implementations§

Source§

impl ScopeGuard

Source

pub fn enter(fields: Vec<ScopeField>, tail_capacity: u16) -> Self

Push a Scope frame.

Source

pub fn enter_context(fields: Vec<ScopeField>) -> Self

Push a Context frame (no tail buffer).

Source

pub fn enter_with_identity( fields: Vec<ScopeField>, kind: ScopeKind, tail_capacity: u16, name: &'static str, target: &'static str, ) -> Self

Push a frame with explicit identity, used by the bridge to stamp (name, target) for obs::SpanTrace.

Source

pub fn enter_with_frame(frame: ScopeFrame) -> Self

Push a fully-built ScopeFrame onto the active scope stack. Used by super::ScopeFrameBuilder::push so external crates can build a frame programmatically (instead of via the obs::scope! macro) and own the resulting RAII guard. Spec 94 D7-3.

Source

pub fn into_inner(self) -> ScopeFrame

Detach the guard so the caller can layer it onto a Future::instrument(...) (the future then re-applies the frame on every poll). The frame is popped immediately so the caller doesn’t hold two copies.

Trait Implementations§

Source§

impl Debug for ScopeGuard

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for ScopeGuard

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.