#[non_exhaustive]pub enum Value {
Null,
Boolean(bool),
Integer(i64),
Float(f64),
Text(String),
}Expand description
A scalar value held inside a StoreEntry::Var.
Value is the narrow, concrete set of primitive types the pipeline
understands: nothing, booleans, 64-bit integers, 64-bit floats, and
owned text. Collections are represented by StoreEntry::Array and
StoreEntry::Map, not by additional Value variants. The enum is
marked #[non_exhaustive] so future scalar additions do not break
external match statements.
The as_* accessors narrow to a specific variant for callers that
know what they are holding; each returns an AccessError::TypeMismatch
on the wrong variant. Use Value::get_type to inspect the type tag
without narrowing.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Null
The absent value.
Boolean(bool)
A boolean.
Integer(i64)
A 64-bit signed integer.
Float(f64)
A 64-bit floating-point number.
Text(String)
An owned UTF-8 string.
Implementations§
Source§impl Value
impl Value
Sourcepub fn as_text(&self) -> Result<&str, AccessError>
pub fn as_text(&self) -> Result<&str, AccessError>
Narrows to a Text, returning a borrowed string
slice. Fails with AccessError::TypeMismatch otherwise.
Sourcepub fn as_integer(&self) -> Result<i64, AccessError>
pub fn as_integer(&self) -> Result<i64, AccessError>
Narrows to an Integer. Fails with
AccessError::TypeMismatch otherwise.
Sourcepub fn as_float(&self) -> Result<f64, AccessError>
pub fn as_float(&self) -> Result<f64, AccessError>
Narrows to a Float. Fails with
AccessError::TypeMismatch otherwise.
Sourcepub fn as_boolean(&self) -> Result<bool, AccessError>
pub fn as_boolean(&self) -> Result<bool, AccessError>
Narrows to a Boolean. Fails with
AccessError::TypeMismatch otherwise.
Sourcepub fn as_null(&self) -> Result<(), AccessError>
pub fn as_null(&self) -> Result<(), AccessError>
Asserts the value is Null. Fails with
AccessError::TypeMismatch otherwise.