pub enum ContextValue {
Bool(bool),
Int(i64),
Float(f64),
String(String),
Bytes(Vec<u8>),
}Expand description
Context value that can hold any type safely
Variants§
Implementations§
Source§impl ContextValue
impl ContextValue
Sourcepub fn as_bool(&self) -> RuleResult<bool>
pub fn as_bool(&self) -> RuleResult<bool>
Try to extract a boolean value
Sourcepub fn as_int(&self) -> RuleResult<i64>
pub fn as_int(&self) -> RuleResult<i64>
Try to extract an integer value
Sourcepub fn as_float(&self) -> RuleResult<f64>
pub fn as_float(&self) -> RuleResult<f64>
Try to extract a float value
Sourcepub fn as_string(&self) -> RuleResult<&str>
pub fn as_string(&self) -> RuleResult<&str>
Try to extract a string value
Sourcepub fn as_bytes(&self) -> RuleResult<&[u8]>
pub fn as_bytes(&self) -> RuleResult<&[u8]>
Try to extract bytes
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ContextValue
impl RefUnwindSafe for ContextValue
impl Send for ContextValue
impl Sync for ContextValue
impl Unpin for ContextValue
impl UnwindSafe for ContextValue
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