Struct Scope Stack
Generated from cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-pii-redaction -p nemo-relay-ffi -p nemo-relay-types -p nemo-relay-plugin -p nemo-relay-worker-proto -p nemo-relay-worker.
Mutable stack of active scopes plus their scope-local registries.
The stack always contains an implicit root agent scope. It owns freshness for work that is not nested under an explicit agent; non-agent scopes inherit their nearest agent’s freshness instead of creating a separate budget. Additional scopes are pushed as the public API opens lifecycle spans and removed when those spans close.
Implementations
impl ScopeStack
impl ScopeStack
new
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.
push
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.
top
pub fn top(&self) -> &ScopeHandle
Return the current top-most scope handle.
Returns
A shared reference to the active scope at the top of the stack.
Notes
This function never returns None because the implicit root scope is always present.
top_mut
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.
root_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.
is_propagated_parent
pub fn is_propagated_parent(&self, uuid: Uuid) -> bool
Whether uuid is the synthetic parent imported from propagation.
scopes
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.
find
pub fn find(&self, uuid: &Uuid) -> Option<&ScopeHandle>
Find a scope handle by UUID.
Parameters
uuid: UUID of the scope to search for.
Returns
Some(&ScopeHandle) when the scope is active on this stack and None otherwise.
remove
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
impl Debug for ScopeStack
impl Debug for ScopeStack
fmt
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for ScopeStack
impl Default for ScopeStack
default
fn default() -> Self