Struct Scope Guard

View as Markdown

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.

pub struct ScopeGuard<'a> { /* private fields */ }

RAII guard for a host scope opened by PluginRuntime::scope or PluginRuntime::scope_at.

A guard may move between threads only while its scope stack is bound on the destination thread. Async middleware restores that binding around each poll; tasks created with tokio::spawn do not inherit it and must not own a guard.

Implementations

impl<'a> ScopeGuard<'a>

impl<'a> ScopeGuard<'a>

handle

pub fn handle(&self) -> Option<&ScopeHandle<'a>>

Returns the active scope handle.

close

pub fn close(
    &mut self,
    output: Option<&Json>,
    metadata: Option<&Json>,
) -> Result<()>

Pops the scope with optional output and metadata.

close_at

pub fn close_at(
    &mut self,
    output: Option<&Json>,
    metadata: Option<&Json>,
    ended_at: SystemTime,
) -> Result<()>

Pops the scope and records ended_at on its end event.

This is typed SDK access to the timestamp slot already carried by the native host’s scope_pop function. The handle remains owned by this guard if the host rejects the close, so Drop can still attempt the ordinary cleanup path.

Trait Implementations

impl Drop for ScopeGuard<'_>

impl Drop for ScopeGuard<'_>

drop

fn drop(&mut self)

impl Send for ScopeGuard<'_>

impl Send for ScopeGuard<'_>