Struct canrun::value::LVar [−][src]
pub struct LVar<T: ?Sized> { /* fields omitted */ }
Expand description
A logical variable that represents a potential value of type T
.
They are typically created with the var()
function.
LVars
are are passed into goals to relate
values and other variables to each other. They can also be
used to query for values in a
ResolvedState
.
The identity of each LVar
is tracked using an internal id. While this id
is visible through the Debug
implementation, it should only be used for
debugging purposes as no guarantees are made about the type or generation of
the id value.
Implementations
Create a new logical var.
The var()
function is typically used as a
shorthand.
Example:
use canrun::{LVar}; let x: LVar<i32> = LVar::new();
Create a labeled logical var.
LVars
are primarily represented by an internal id. A textual label can
assist in debugging.
No guarantees are made about the actual debug string. Two LVars
created separately are not considered to be the same, even if they
have the same label.
Examples:
use canrun::{LVar}; let x: LVar<i32> = LVar::labeled("foo"); assert!(format!("{:?}", x).contains("foo"));
let x: LVar<i32> = LVar::labeled("foo"); let y: LVar<i32> = LVar::labeled("foo"); assert_eq!(x, x); assert_ne!(x, y);
Trait Implementations
Extract a reified Self
from a compatible
ResolvedState
. This trait is usually
used indirectly through the Query
trait. Read more
Auto Trait Implementations
impl<T: ?Sized> RefUnwindSafe for LVar<T> where
T: RefUnwindSafe,
impl<T: ?Sized> UnwindSafe for LVar<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self