pub trait ContextView: Send + Sync {
// Required methods
fn has(&self, key: ContextKey) -> bool;
fn get(&self, key: ContextKey) -> &[Fact];
// Provided methods
fn get_proposals(&self, key: ContextKey) -> &[ProposedFact] { ... }
fn count(&self, key: ContextKey) -> usize { ... }
}Expand description
Re-export the Context trait from converge-pack.
Suggestor and Invariant implementations use &dyn ContextView in their signatures.
Read-only view of the shared context.
Suggestors receive &dyn Context during accepts() and execute().
They cannot mutate it directly — mutations happen through AgentEffect
after the engine collects all effects and merges them deterministically.
Required Methods§
Sourcefn has(&self, key: ContextKey) -> bool
fn has(&self, key: ContextKey) -> bool
Check whether any facts exist under this key.
Sourcefn get(&self, key: ContextKey) -> &[Fact]
fn get(&self, key: ContextKey) -> &[Fact]
Get all facts under this key.
Provided Methods§
Sourcefn get_proposals(&self, key: ContextKey) -> &[ProposedFact]
fn get_proposals(&self, key: ContextKey) -> &[ProposedFact]
Get all proposed facts (unvalidated).
Sourcefn count(&self, key: ContextKey) -> usize
fn count(&self, key: ContextKey) -> usize
Count of facts under a key.