pub enum Value {
String(String),
Number(f64),
Integer(i64),
Boolean(bool),
Array(Vec<Value>),
Object(HashMap<String, Value>),
Null,
}Expand description
Represents a value that can be used in rule conditions and actions
Variants§
String(String)
String value
Number(f64)
Floating point number
Integer(i64)
Integer value
Boolean(bool)
Boolean value
Array(Vec<Value>)
Array of values
Object(HashMap<String, Value>)
Object with key-value pairs
Null
Null value
Implementations§
Source§impl Value
impl Value
Sourcepub fn as_integer(&self) -> Option<i64>
pub fn as_integer(&self) -> Option<i64>
Get integer value if this is an integer
Sourcepub fn as_boolean(&self) -> Option<bool>
pub fn as_boolean(&self) -> Option<bool>
Get boolean value if this is a boolean
Sourcepub fn call_method(
&mut self,
method: &str,
args: Vec<Value>,
) -> Result<Value, String>
pub fn call_method( &mut self, method: &str, args: Vec<Value>, ) -> Result<Value, String>
Call a method on this value with given arguments
Sourcepub fn get_property(&self, property: &str) -> Option<Value>
pub fn get_property(&self, property: &str) -> Option<Value>
Get a property from this object
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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 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