pub enum Value<T: Unify> {
Var(LVar<T>),
Resolved(Rc<T>),
}
Expand description
Contain individual resolved values or variables that can be bound through unification.
Variants§
Var(LVar<T>)
Even though they do not contain a value, they are parameterized with the type they can potentially be bound to. This ensures that they can only be unified with values of the same type.
Resolved(Rc<T>)
A resolved value.
When a state is split into an arbitrary number of resolved states, some of the internal data structures often need to be cloned. In an attempt to avoid unnecessary cloning of every value in the state, we wrap it in an Rc so that references can be shared.
Implementations§
source§impl<T: Unify> Value<T>
impl<T: Unify> Value<T>
sourcepub fn new(t: T) -> Value<T>
pub fn new(t: T) -> Value<T>
Create a new logical Value
wrapping a T
.
Example:
use canrun::Value;
let x: Value<i32> = Value::new(1);
Trait Implementations§
source§impl<T: PartialEq + Unify> PartialEq<Value<T>> for Value<T>
impl<T: PartialEq + Unify> PartialEq<Value<T>> for Value<T>
impl<T: Eq + Unify> Eq for Value<T>
impl<T: Unify> StructuralEq for Value<T>
impl<T: Unify> StructuralPartialEq for Value<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Value<T>where T: RefUnwindSafe,
impl<T> !Send for Value<T>
impl<T> !Sync for Value<T>
impl<T> Unpin for Value<T>where T: Unpin,
impl<T> UnwindSafe for Value<T>where T: UnwindSafe + RefUnwindSafe,
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