pub struct RunContext { /* private fields */ }Expand description
Per-unit run context — the Rust mirror of Python’s
ContextManager for the typed-channel concern.
All mutable state lives behind Mutex so the dispatch functions
can be called from a multi-threaded executor. Arc<TypedEventBus>
because the bus itself is already internally synchronised.
Implementations§
Source§impl RunContext
impl RunContext
Sourcepub fn new(bus: Arc<TypedEventBus>) -> Self
pub fn new(bus: Arc<TypedEventBus>) -> Self
Wrap an existing bus in a fresh context.
pub fn bus(&self) -> &TypedEventBus
Sourcepub fn from_ir_program(ir: &IRProgram) -> Self
pub fn from_ir_program(ir: &IRProgram) -> Self
Bootstrap a context from an IRProgram. Every IRChannel is
registered on a fresh TypedEventBus whose registry is the
canonical source for typed handles during the run.
pub fn set_variable(&self, name: impl Into<String>, value: RunValue)
pub fn get_variable(&self, name: &str) -> Option<RunValue>
pub fn set_step_result(&self, name: impl Into<String>, value: RunValue)
pub fn get_step_result(&self, name: &str) -> Option<RunValue>
pub fn bind_discovered_handle( &self, alias: impl Into<String>, handle: TypedChannelHandle, )
pub fn discovered_handles_snapshot(&self) -> HashMap<String, TypedChannelHandle>
pub fn record_capability(&self, channel: impl Into<String>, cap: Capability)
pub fn take_capability(&self, channel: &str) -> Option<Capability>
Sourcepub fn resolve_value_ref(
&self,
value_ref: &str,
) -> Result<RunValue, DispatchError>
pub fn resolve_value_ref( &self, value_ref: &str, ) -> Result<RunValue, DispatchError>
Resolve an emit value_ref against the live state.
Lookup order #1 → #3, walking nested segments after dots:
discovered_handles[head]variables[head]step_results[head]
On dotted paths, after the head the remaining segments walk either:
- JSON object access (
Json), - struct-like field access on the handle struct (very few
fields; we expose the same surface the Python
getattrreaches on aTypedChannelHandle—name,message,qos,lifetime,persistence,shield_ref).
Auto Trait Implementations§
impl !Freeze for RunContext
impl !RefUnwindSafe for RunContext
impl !UnwindSafe for RunContext
impl Send for RunContext
impl Sync for RunContext
impl Unpin for RunContext
impl UnsafeUnpin for RunContext
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.