pub enum EloValue {
Integer(i64),
Float(f64),
String(String),
Boolean(bool),
Null,
Array(Vec<EloValue>),
Object(BTreeMap<String, EloValue>),
}Expand description
Represents a runtime value in ELO
EloValue supports dynamic typing with support for all ELO data types: scalars (int, float, string, bool, null) and collections (arrays, objects).
Variants§
Integer(i64)
Integer value (64-bit signed)
Float(f64)
Float value (64-bit IEEE 754)
String(String)
String value
Boolean(bool)
Boolean value
Null
Null/None value
Array(Vec<EloValue>)
Array of values (homogeneous or heterogeneous)
Object(BTreeMap<String, EloValue>)
Object as key-value pairs (sorted by key for consistency)
Implementations§
Source§impl EloValue
impl EloValue
Sourcepub fn to_integer(&self) -> Option<i64>
pub fn to_integer(&self) -> Option<i64>
Convert to integer if possible
Sourcepub fn to_string_value(&self) -> String
pub fn to_string_value(&self) -> String
Convert to string
Sourcepub fn to_boolean(&self) -> bool
pub fn to_boolean(&self) -> bool
Convert to boolean
Sourcepub fn is_numeric(&self) -> bool
pub fn is_numeric(&self) -> bool
Check if this value is numeric (integer or float)
Sourcepub fn object_get(&self, key: &str) -> Option<EloValue>
pub fn object_get(&self, key: &str) -> Option<EloValue>
Get object field value
Sourcepub fn add(&self, other: &EloValue) -> Result<EloValue, String>
pub fn add(&self, other: &EloValue) -> Result<EloValue, String>
Add two values (numeric addition or string concatenation)
Sourcepub fn logical_and(&self, other: &EloValue) -> EloValue
pub fn logical_and(&self, other: &EloValue) -> EloValue
Logical AND
Sourcepub fn logical_or(&self, other: &EloValue) -> EloValue
pub fn logical_or(&self, other: &EloValue) -> EloValue
Logical OR
Sourcepub fn logical_not(&self) -> EloValue
pub fn logical_not(&self) -> EloValue
Logical NOT
Trait Implementations§
impl StructuralPartialEq for EloValue
Auto Trait Implementations§
impl Freeze for EloValue
impl RefUnwindSafe for EloValue
impl Send for EloValue
impl Sync for EloValue
impl Unpin for EloValue
impl UnwindSafe for EloValue
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