pub struct LVar<T> { /* private fields */ }
Expand description
A logical variable that represents a potential value of type T
.
LVars
are are passed into goals to relate
values and other variables to each other. They can also be
used to query for values.
The main reason to deal with an LVar
directly as opposed to just
Value::Var
is that LVar
implements Copy
,
which makes it more convenient when the same var is shared between various goals,
closures and other places.
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. Also, these ids are only valid within the context of a single
execution. They cannot be safely persisted or shared between processes.
Create a new logical var.
use canrun::LVar;
let x: LVar<isize> = LVar::new();
Performs copy-assignment from
source
.
Read more
Formats the value using the given formatter.
Read more
Returns the “default value” for a type.
Read more
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self
and other
values to be equal, and is used
by ==
.
This method tests for !=
. The default implementation is almost always
sufficient, and should not be overridden without very good reason.
The “concrete” type that Self
reifies to.
Extract a reified
Self
from a compatible
State
. This trait is usually
used indirectly through the
Query
trait.
Read more
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From<T> for U
chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more
Uses borrowed data to replace owned data, usually by cloning.
Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.