> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/relay/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/relay/_mcp/server.

# Module scope_stack

> Scope stack storage and propagation helpers.

Generated from `cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-ffi`.

Scope stack storage and propagation helpers.

The runtime tracks the current scope hierarchy through a shared [`ScopeStack`](/reference/api/rust-library-reference/nemo-relay/api/runtime/scope_stack/struct-scopestack) stored in task-local or thread-local state. Advanced callers can use this module to inspect the active scope chain or propagate scope context into worker threads.

## Structs

* [ScopeStack](/reference/api/rust-library-reference/nemo-relay/api/runtime/scope_stack/struct-scopestack): Mutable stack of active scopes plus their scope-local registries.
* [ThreadScopeStackBinding](/reference/api/rust-library-reference/nemo-relay/api/runtime/scope_stack/struct-threadscopestackbinding): Captured thread-local scope stack binding.

## Statics

* [TASK\_SCOPE\_STACK](/reference/api/rust-library-reference/nemo-relay/api/runtime/scope_stack/static-task-scope-stack): Task-local scope stack handle used by async execution contexts.

## Functions

* [capture\_thread\_scope\_stack](/reference/api/rust-library-reference/nemo-relay/api/runtime/scope_stack/fn-capture-thread-scope-stack): Capture the current thread-local scope stack binding.
* [create\_scope\_stack](/reference/api/rust-library-reference/nemo-relay/api/runtime/scope_stack/fn-create-scope-stack): Create a new scope stack handle with an implicit root scope.
* [current\_scope\_stack](/reference/api/rust-library-reference/nemo-relay/api/runtime/scope_stack/fn-current-scope-stack): Return the scope stack visible to the current execution context.
* [propagate\_scope\_to\_thread](/reference/api/rust-library-reference/nemo-relay/api/runtime/scope_stack/fn-propagate-scope-to-thread): Capture the current scope stack handle for use in another thread.
* [restore\_thread\_scope\_stack](/reference/api/rust-library-reference/nemo-relay/api/runtime/scope_stack/fn-restore-thread-scope-stack): Restore a previously captured thread-local scope stack binding.
* [scope\_stack\_active](/reference/api/rust-library-reference/nemo-relay/api/runtime/scope_stack/fn-scope-stack-active): Report whether the current context has an explicitly active scope stack.
* [set\_thread\_scope\_stack](/reference/api/rust-library-reference/nemo-relay/api/runtime/scope_stack/fn-set-thread-scope-stack): Install an explicit scope stack for the current thread.
* [sync\_thread\_scope\_stack](/reference/api/rust-library-reference/nemo-relay/api/runtime/scope_stack/fn-sync-thread-scope-stack): Synchronize the thread-local scope stack without marking it explicit.
* [task\_scope\_push](/reference/api/rust-library-reference/nemo-relay/api/runtime/scope_stack/fn-task-scope-push): Push a scope handle onto the active stack.
* [task\_scope\_remove](/reference/api/rust-library-reference/nemo-relay/api/runtime/scope_stack/fn-task-scope-remove): Remove a scope handle from the active stack.
* [task\_scope\_top](/reference/api/rust-library-reference/nemo-relay/api/runtime/scope_stack/fn-task-scope-top): Clone the current top-most scope handle from the active stack.

## Type Aliases

* [ScopeStackHandle](/reference/api/rust-library-reference/nemo-relay/api/runtime/scope_stack/type-scopestackhandle): Shared handle type for the runtime scope stack.