pub struct Runtime {
pub role: String,
pub session: Option<String>,
/* private fields */
}Expand description
The live agent for ONE role: program + session state + commitment lifecycle + transcript.
Fields§
§role: String§session: Option<String>public session id (set by SessionHost)
Implementations§
Source§impl Runtime
impl Runtime
pub fn new(prog: &ProtocolProgram, role: &str) -> Result<Self, IdlError>
pub fn state(&self, name: &str) -> Option<&StateValue>
pub fn set_state(&mut self, name: &str, v: StateValue) -> Result<(), String>
Sourcepub fn states_snapshot(&self) -> BTreeMap<String, StateValue>
pub fn states_snapshot(&self) -> BTreeMap<String, StateValue>
§35.9: full state snapshot (for replay verification)
Sourcepub fn enforce_dialogue(&mut self, on: bool)
pub fn enforce_dialogue(&mut self, on: bool)
§16: enable strict dialogue-matrix enforcement for this runtime
pub fn commitment(&self) -> CommitmentStatus
Sourcepub fn commitment_status(&self, id: &str) -> Option<CommitmentStatus>
pub fn commitment_status(&self, id: &str) -> Option<CommitmentStatus>
§51: lifecycle status of a NAMED commitment (Unset = unknown id)
pub fn transcript(&self) -> &[LogEntry]
Sourcepub fn deliver_internal_error(&mut self, reason: String) -> Vec<OutEvent>
pub fn deliver_internal_error(&mut self, reason: String) -> Vec<OutEvent>
§38.7: route an internal failure to the session’s on error
handler. The failure is always logged; the handler runs at most one
level deep (failures inside it are logged only — no error loops).
Sourcepub fn deliver(&mut self, ev: Event) -> Vec<OutEvent>
pub fn deliver(&mut self, ev: Event) -> Vec<OutEvent>
Deliver an event: find the FIRST handler whose trigger matches and execute its actions in order. Returns what the agent emits.
Auto Trait Implementations§
impl Freeze for Runtime
impl RefUnwindSafe for Runtime
impl Send for Runtime
impl Sync for Runtime
impl Unpin for Runtime
impl UnsafeUnpin for Runtime
impl UnwindSafe for Runtime
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