[−][src]Enum canrun::value::Val
The possible states a value can be in.
Variants
Var(LVar<T>)
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
impl<T: Debug> Val<T>
[src]
pub fn resolved(&self) -> Result<&T, LVar<T>>
[src]
Attempt to extract a reference to resolved value (&T
) or return the
LVar
if the value is not yet resolved.
Examples:
use canrun::{var, val, LVar}; let x: LVar<i32> = var(); let x_val = val!(x); assert_eq!(x_val.resolved(), Err(x));
let y_val = val!(1); assert_eq!(y_val.resolved(), Ok(&1));
pub fn is_var(&self) -> bool
[src]
Return true
if the Val
is an unresolved variable.
Example:
use canrun::{var, val, Val}; let x: Val<i32> = val!(var()); assert!(x.is_var());
pub fn is_resolved(&self) -> bool
[src]
Return true
if the Val
is a resolved value.
Example:
use canrun::{var, val, Val}; let x: Val<i32> = val!(1); assert!(x.is_resolved());
Trait Implementations
impl<T: Debug> Clone for Val<T>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a, T: Debug> Debug for Val<T>
[src]
impl<T: Eq + Debug> Eq for Val<T>
[src]
impl<T: Hash + Debug> Hash for Val<T>
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: Debug> IntoVal<T> for Val<T>
[src]
impl<'_, T: Debug> IntoVal<T> for &'_ Val<T>
[src]
impl<T: PartialEq + Debug> PartialEq<Val<T>> for Val<T>
[src]
impl<'a, T, D> ReifyIn<'a, D> for Val<T> where
T: ReifyIn<'a, D> + Debug,
D: DomainType<'a, T> + 'a,
[src]
T: ReifyIn<'a, D> + Debug,
D: DomainType<'a, T> + 'a,
Auto Trait Implementations
impl<T> !RefUnwindSafe for Val<T>
impl<T> !Send for Val<T>
impl<T> !Sync for Val<T>
impl<T: ?Sized> Unpin for Val<T> where
T: Unpin,
T: Unpin,
impl<T: ?Sized> UnwindSafe for Val<T> where
T: RefUnwindSafe + UnwindSafe,
T: RefUnwindSafe + UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,