pub struct Bindings { /* private fields */ }Expand description
Variable bindings during proof
This type manages variable-to-value mappings during backward chaining, with support for merging, conflict detection, and binding propagation.
Implementations§
Source§impl Bindings
impl Bindings
Sourcepub fn bind(&mut self, var_name: String, value: Value) -> Result<()>
pub fn bind(&mut self, var_name: String, value: Value) -> Result<()>
Bind a variable to a value
If the variable is already bound, this checks that the new value matches the existing binding. Returns an error if there’s a conflict.
§Example
ⓘ
let mut bindings = Bindings::new();
bindings.bind("X".to_string(), Value::Number(42.0))?;
// This will succeed (same value)
bindings.bind("X".to_string(), Value::Number(42.0))?;
// This will fail (different value)
bindings.bind("X".to_string(), Value::Number(100.0))?; // Error!Sourcepub fn merge(&mut self, other: &Bindings) -> Result<()>
pub fn merge(&mut self, other: &Bindings) -> Result<()>
Merge bindings from another set
This attempts to merge all bindings from other into this set.
If any conflicts are detected, returns an error and leaves this set unchanged.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Bindings
impl RefUnwindSafe for Bindings
impl Send for Bindings
impl Sync for Bindings
impl Unpin for Bindings
impl UnwindSafe for Bindings
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