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

Returns a copy of the value. Read more

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

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

Convert various T related values into a Val<T>. Read more

Convert various T related values into a Val<T>. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The “concrete” type that Self reifies to.

Extract a reified Self from a compatible ResolvedState. This trait is usually used indirectly through the Query trait. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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.