pub struct ScopeStack { /* private fields */ }Expand description
Mutable stack of active scopes plus their scope-local registries.
The stack always contains an implicit root scope. Additional scopes are pushed as the public API opens lifecycle spans and removed when those spans close.
Implementations§
Source§impl ScopeStack
impl ScopeStack
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new scope stack containing only the implicit root scope.
§Returns
A ScopeStack initialized with a single root scope and no
scope-local registries.
Sourcepub fn push(&mut self, handle: ScopeHandle)
pub fn push(&mut self, handle: ScopeHandle)
Push a scope handle onto the top of the stack.
§Parameters
handle: Scope handle to make the new top-most active scope.
Sourcepub fn top(&self) -> &ScopeHandle
pub fn top(&self) -> &ScopeHandle
Sourcepub fn top_mut(&mut self) -> &mut ScopeHandle
pub fn top_mut(&mut self) -> &mut ScopeHandle
Return the current top-most scope handle mutably.
§Returns
A mutable reference to the active scope at the top of the stack.
Sourcepub fn root_uuid(&self) -> Uuid
pub fn root_uuid(&self) -> Uuid
Return the UUID of the implicit root scope.
§Returns
The stable UUID of the root scope stored at the bottom of the stack.
Sourcepub fn scopes(&self) -> &[ScopeHandle]
pub fn scopes(&self) -> &[ScopeHandle]
Return the full ordered stack of scope handles.
§Returns
A slice of scopes ordered from root to the current top-most scope.
Sourcepub fn find(&self, uuid: &Uuid) -> Option<&ScopeHandle>
pub fn find(&self, uuid: &Uuid) -> Option<&ScopeHandle>
Sourcepub fn remove(&mut self, uuid: &Uuid) -> Result<ScopeHandle>
pub fn remove(&mut self, uuid: &Uuid) -> Result<ScopeHandle>
Remove the current top scope if it matches uuid.
§Parameters
uuid: UUID of the scope expected to be at the top of the stack.
§Returns
A Result containing the removed ScopeHandle.
§Errors
Returns FlowError::InvalidArgument when the scope exists but is not
the current top of the stack or when the caller attempts to remove the
implicit root scope. Returns FlowError::NotFound when the UUID is
not present on the stack.
Trait Implementations§
Source§impl Debug for ScopeStack
impl Debug for ScopeStack
Auto Trait Implementations§
impl !RefUnwindSafe for ScopeStack
impl !UnwindSafe for ScopeStack
impl Freeze for ScopeStack
impl Send for ScopeStack
impl Sync for ScopeStack
impl Unpin for ScopeStack
impl UnsafeUnpin for ScopeStack
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request