pub enum Value {
Number(f64),
Bool(bool),
Null,
List(ListPointer),
String(StringPointer),
Record(RecordPointer),
Lambda(LambdaPointer),
Spread(IterablePointer),
BuiltIn(BuiltInFunction),
}Variants§
Number(f64)
A number is a floating-point value.
Bool(bool)
A boolean value is either true or false.
Null
A null value represents the absence of a value.
List(ListPointer)
A list is a sequence of values.
String(StringPointer)
A string is a sequence of characters.
Record(RecordPointer)
A record is a collection of key-value pairs.
Lambda(LambdaPointer)
A lambda is a function definition.
Spread(IterablePointer)
A spread value is “spread” into its container when it is used in a list, record, or function call. (internal only)
BuiltIn(BuiltInFunction)
A built-in function is a function that is implemented in Rust.
Implementations§
Source§impl Value
impl Value
Sourcepub fn equals(&self, other: &Value, heap: &Heap) -> Result<bool>
pub fn equals(&self, other: &Value, heap: &Heap) -> Result<bool>
Compare two values for equality by their actual content, not by reference
Sourcepub fn compare(&self, other: &Value, heap: &Heap) -> Result<Option<Ordering>>
pub fn compare(&self, other: &Value, heap: &Heap) -> Result<Option<Ordering>>
Compare two values for ordering
pub fn get_type(&self) -> ValueType
pub fn is_number(&self) -> bool
pub fn is_list(&self) -> bool
pub fn is_spread(&self) -> bool
pub fn is_bool(&self) -> bool
pub fn is_lambda(&self) -> bool
pub fn is_string(&self) -> bool
pub fn is_null(&self) -> bool
pub fn is_built_in(&self) -> bool
pub fn is_callable(&self) -> bool
pub fn as_number(&self) -> Result<f64>
pub fn as_list<'h>(&self, heap: &'h Heap) -> Result<&'h Vec<Value>>
pub fn as_spread<'h>(&self, heap: &'h Heap) -> Result<&'h HeapValue>
pub fn as_bool(&self) -> Result<bool>
pub fn as_lambda<'h>(&self, heap: &'h Heap) -> Result<&'h LambdaDef>
pub fn as_string<'h>(&self, heap: &'h Heap) -> Result<&'h str>
pub fn as_null(&self) -> Result<()>
pub fn as_built_in(&self) -> Result<&str>
pub fn as_record<'h>( &self, heap: &'h Heap, ) -> Result<&'h IndexMap<String, Value>>
pub fn as_list_pointer(&self) -> Result<ListPointer>
pub fn as_string_pointer(&self) -> Result<StringPointer>
pub fn as_record_pointer(&self) -> Result<RecordPointer>
pub fn as_lambda_pointer(&self) -> Result<LambdaPointer>
pub fn as_iterable_pointer(&self) -> Result<IterablePointer>
pub fn to_serializable_value(&self, heap: &Heap) -> Result<SerializableValue>
pub fn reify<'h>(&self, heap: &'h Heap) -> Result<ReifiedValue<'h>>
Sourcepub fn stringify_internal(&self, heap: &Heap) -> String
pub fn stringify_internal(&self, heap: &Heap) -> String
Stringify the value. Returns the same thing as stringify, except for Value::String, which is returned without wrapping quotes. Use this for string concatenation, formatting, etc. Don’t use this for displaying values to the user.