pub enum Value {
Bool(bool),
Int(i64),
Str(String),
Seq(Vec<Value>),
Set(BTreeSet<Value>),
Record(BTreeMap<String, Value>),
Func(BTreeMap<Value, Value>),
Infinite(Infinite),
}Expand description
A TLA+ value.
Sequences, records and functions are all functions in TLA+, and the same
value must not have two representations or equality would depend on how it
was written. Value::function is the only way to build one, and it picks
the representation from the domain: 1..n gives a sequence, all-string
gives a record, anything else stays a general function.
Variants§
Bool(bool)
Int(i64)
Str(String)
Seq(Vec<Value>)
Set(BTreeSet<Value>)
Record(BTreeMap<String, Value>)
Func(BTreeMap<Value, Value>)
Infinite(Infinite)
A set too large to enumerate. Membership is decidable; iteration is not.
Implementations§
Source§impl Value
impl Value
pub fn set(items: impl IntoIterator<Item = Value>) -> Value
pub fn string(s: impl Into<String>) -> Value
pub fn interval(lo: i64, hi: i64) -> Value
pub fn record(fields: impl IntoIterator<Item = (String, Value)>) -> Value
Sourcepub fn function(entries: BTreeMap<Value, Value>) -> Value
pub fn function(entries: BTreeMap<Value, Value>) -> Value
Build a function, choosing the representation its domain implies.
Sourcepub fn entries(&self) -> Option<BTreeMap<Value, Value>>
pub fn entries(&self) -> Option<BTreeMap<Value, Value>>
The function’s graph, for values that are functions.
pub fn domain(&self) -> Option<BTreeSet<Value>>
pub fn apply(&self, key: &Value) -> Option<Value>
pub fn type_name(&self) -> &'static str
pub fn is_set(&self) -> bool
Trait Implementations§
impl Eq for Value
Source§impl Ord for Value
impl Ord for Value
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Value
impl PartialOrd for Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
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