Skip to main content

DynContext

Trait DynContext 

Source
pub trait DynContext: Send {
    // Required methods
    fn read(&self, key: &ContextKey) -> Result<Option<Value>, ContextError>;
    fn write(
        &mut self,
        key: ContextKey,
        value: Value,
    ) -> Result<(), ContextError>;
    fn delete(&mut self, key: &ContextKey) -> Result<(), ContextError>;
    fn dump(&self) -> Result<Value, ContextError>;
}
Expand description

Dynamic context interface.

Contract:

  • dump() returns a full snapshot of current state (canonical JSON object recommended).
  • Implementations MUST ensure deterministic serialization of snapshot artifacts.

Required Methods§

Source

fn read(&self, key: &ContextKey) -> Result<Option<Value>, ContextError>

Reads a raw JSON value from context.

Source

fn write(&mut self, key: ContextKey, value: Value) -> Result<(), ContextError>

Writes a raw JSON value into context.

Source

fn delete(&mut self, key: &ContextKey) -> Result<(), ContextError>

Deletes a context entry if it exists.

Source

fn dump(&self) -> Result<Value, ContextError>

Full snapshot of current context state.

Implementors§