Enum zen_expression::variable::Variable

source ·
pub enum Variable<'arena> {
    Null,
    Bool(bool),
    Number(Decimal),
    String(&'arena str),
    Array(BumpVec<'arena, Variable<'arena>>),
    Object(BumpMap<'arena, &'arena str, Variable<'arena>>),
}

Variants§

§

Null

§

Bool(bool)

§

Number(Decimal)

§

String(&'arena str)

§

Array(BumpVec<'arena, Variable<'arena>>)

§

Object(BumpMap<'arena, &'arena str, Variable<'arena>>)

Implementations§

source§

impl<'arena> Variable<'arena>

source

pub fn empty_object(arena: &'arena Bump) -> Self

source

pub fn empty_array(arena: &'arena Bump) -> Self

source

pub fn as_str(&self) -> Option<&'arena str>

source

pub fn as_array(&self) -> Option<&BumpVec<'arena, Variable<'arena>>>

source

pub fn as_object( &self, ) -> Option<&BumpMap<'arena, &'arena str, Variable<'arena>>>

source

pub fn as_bool(&self) -> Option<bool>

source

pub fn type_name(&self) -> &'static str

source

pub fn to_value(&self) -> Value

source

pub fn clone_in<'new>(&self, arena: &'new Bump) -> Variable<'new>

source

pub fn dot(&self, key: &str) -> Option<&Variable<'arena>>

source

pub fn dot_mut(&mut self, key: &str) -> Option<&mut Variable<'arena>>

source

pub fn dot_insert( &mut self, arena: &'arena Bump, key: &str, variable: Variable<'arena>, ) -> Option<&mut Variable<'arena>>

Trait Implementations§

source§

impl<'arena> Debug for Variable<'arena>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'arena> Display for Variable<'arena>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<'arena> PartialEq for Variable<'arena>

source§

fn eq(&self, other: &Variable<'arena>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'arena> Serialize for Variable<'arena>

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryFrom<&Variable<'_>> for NaiveDateTime

§

type Error = VMError

The type returned in the event of a conversion error.
source§

fn try_from(value: &Variable<'_>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'arena> Eq for Variable<'arena>

source§

impl<'arena> StructuralPartialEq for Variable<'arena>

Auto Trait Implementations§

§

impl<'arena> Freeze for Variable<'arena>

§

impl<'arena> !RefUnwindSafe for Variable<'arena>

§

impl<'arena> !Send for Variable<'arena>

§

impl<'arena> !Sync for Variable<'arena>

§

impl<'arena> Unpin for Variable<'arena>

§

impl<'arena> !UnwindSafe for Variable<'arena>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.