pub struct SemanticBlackboard { /* private fields */ }Expand description
The semantic blackboard — a collection of observable channels with constraint propagation.
Implementations§
Source§impl SemanticBlackboard
impl SemanticBlackboard
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty blackboard: no channels, no pinned root constraints, global Lamport 0.
Sourcepub fn get_channel(&self, name: &str) -> Option<&Channel>
pub fn get_channel(&self, name: &str) -> Option<&Channel>
Get a channel by name (immutable).
Sourcepub fn write(&mut self, channel: &str, quin: NQuin) -> Result<(), String>
pub fn write(&mut self, channel: &str, quin: NQuin) -> Result<(), String>
Write a Quin to a named channel.
Sourcepub fn add_constraint(
&mut self,
channel: &str,
constraint: Constraint,
) -> Result<(), String>
pub fn add_constraint( &mut self, channel: &str, constraint: Constraint, ) -> Result<(), String>
Add a constraint to a channel.
Sourcepub fn add_root_constraint(
&mut self,
constraint: Constraint,
) -> Result<(), String>
pub fn add_root_constraint( &mut self, constraint: Constraint, ) -> Result<(), String>
Add a pinned root constraint (inherited by all channels).
Sourcepub fn check_all(&self) -> Vec<ConstraintViolation>
pub fn check_all(&self) -> Vec<ConstraintViolation>
Check all constraints on all channels.
Sourcepub fn pinned_constraints(&self) -> Vec<Constraint>
pub fn pinned_constraints(&self) -> Vec<Constraint>
Get all pinned constraints (root + channel-level) for propagation.
Sourcepub fn propagate_to(
&self,
downstream: &mut SemanticBlackboard,
) -> Result<(), String>
pub fn propagate_to( &self, downstream: &mut SemanticBlackboard, ) -> Result<(), String>
Propagate pinned constraints from this blackboard to a downstream blackboard (for DAG node inheritance).
Sourcepub fn freeze_channel(&mut self, channel: &str) -> Result<(), String>
pub fn freeze_channel(&mut self, channel: &str) -> Result<(), String>
Freeze a channel (make read-only).
Sourcepub fn channel_count(&self) -> usize
pub fn channel_count(&self) -> usize
Get the number of channels.
Sourcepub fn channel_hashes(&self) -> Vec<u64>
pub fn channel_hashes(&self) -> Vec<u64>
List all channel name hashes.
Sourcepub fn read_channel_vec(&self, channel: &str) -> Vec<NQuin>
pub fn read_channel_vec(&self, channel: &str) -> Vec<NQuin>
Read all state from a named channel as a Vec (for DAG node input). Returns an empty Vec if the channel does not exist.
Sourcepub fn channel_has_data(&self, channel: &str) -> bool
pub fn channel_has_data(&self, channel: &str) -> bool
Check whether a named channel exists and has any state.
Trait Implementations§
Source§impl Debug for SemanticBlackboard
impl Debug for SemanticBlackboard
Source§impl Default for SemanticBlackboard
impl Default for SemanticBlackboard
Source§fn default() -> Self
fn default() -> Self
Equivalent to SemanticBlackboard::new.
Auto Trait Implementations§
impl Freeze for SemanticBlackboard
impl RefUnwindSafe for SemanticBlackboard
impl Send for SemanticBlackboard
impl Sync for SemanticBlackboard
impl Unpin for SemanticBlackboard
impl UnsafeUnpin for SemanticBlackboard
impl UnwindSafe for SemanticBlackboard
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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> ⓘ
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 more