Struct Plugin Runtime

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.

1pub struct PluginRuntime { /* private fields */ }

Cloneable high-level runtime handle for host APIs available to native plugins.

Implementations

impl PluginRuntime

impl PluginRuntime

new

pub fn new(host: &NemoRelayNativeHostApiV1) -> Self

Creates a runtime handle from the host ABI table.

host_api

pub fn host_api(&self) -> &NemoRelayNativeHostApiV1

Returns the underlying host ABI table.

current_scope

pub fn current_scope(&self) -> Result<ScopeHandle<'_>>

Retrieves the current scope handle.

push_scope

pub fn push_scope(
    &self,
    name: &str,
    scope_type: ScopeType,
    data: Option<&Json>,
    metadata: Option<&Json>,
    input: Option<&Json>,
) -> Result<ScopeHandle<'_>>

Pushes a scope and emits its start event.

pop_scope

pub fn pop_scope(
    &self,
    handle: &ScopeHandle<'_>,
    output: Option<&Json>,
    metadata: Option<&Json>,
) -> Result<()>

Pops a scope and emits its end event.

scope

pub fn scope(
    &self,
    name: &str,
    scope_type: ScopeType,
    data: Option<&Json>,
    metadata: Option<&Json>,
    input: Option<&Json>,
) -> Result<ScopeGuard<'_>>

Opens a scope that is popped automatically when the guard is closed or dropped.

emit_mark

pub fn emit_mark(
    &self,
    name: &str,
    data: Option<&Json>,
    metadata: Option<&Json>,
) -> Result<()>

Emits a mark event under the current scope.

create_scope_stack

pub fn create_scope_stack(&self) -> Result<ScopeStack<'_>>

Creates a new independent scope stack.

capture_scope_stack_thread

pub fn capture_scope_stack_thread(&self) -> Result<ScopeStackBinding<'_>>

Captures the current thread-local scope-stack binding.

scope_stack_active

pub fn scope_stack_active(&self) -> bool

Returns whether the current context has an explicitly active scope stack.

bind_scope_stack_thread

pub fn bind_scope_stack_thread<'a>(
    &'a self,
    stack: &'a ScopeStack<'a>,
) -> Result<ThreadScopeStackGuard<'a>>

Binds stack to the current OS thread until the returned guard is dropped.

Trait Implementations

impl Clone for PluginRuntime

impl Clone for PluginRuntime

clone

fn clone(&self) -> PluginRuntime

clone_from

fn clone_from(&mut self, source: &Self)