[][src]Enum jrsonnet_evaluator::Val

pub enum Val {
    Bool(bool),
    Null,
    Str(Rc<str>),
    Num(f64),
    Lazy(LazyVal),
    Arr(Rc<Vec<Val>>),
    Obj(ObjValue),
    Func(Rc<FuncVal>),
}

Variants

Bool(bool)
Null
Str(Rc<str>)
Num(f64)
Lazy(LazyVal)
Arr(Rc<Vec<Val>>)
Func(Rc<FuncVal>)

Implementations

impl Val[src]

pub fn new_checked_num(num: f64) -> Result<Self>[src]

Creates Val::Num after checking for numeric overflow. As numbers are f64, we can just check for their finity.

pub fn assert_type(
    &self,
    context: &'static str,
    val_type: ValType
) -> Result<()>
[src]

pub fn try_cast_bool(self, context: &'static str) -> Result<bool>[src]

pub fn try_cast_str(self, context: &'static str) -> Result<Rc<str>>[src]

pub fn try_cast_num(self, context: &'static str) -> Result<f64>[src]

pub fn inplace_unwrap(&mut self) -> Result<()>[src]

pub fn unwrap_if_lazy(&self) -> Result<Self>[src]

pub fn value_type(&self) -> Result<ValType>[src]

pub fn to_string(&self) -> Result<Rc<str>>[src]

pub fn manifest_multi(
    &self,
    ty: &ManifestFormat
) -> Result<Vec<(Rc<str>, Rc<str>)>>
[src]

Expects value to be object, outputs (key, manifested value) pairs

pub fn manifest_stream(&self, ty: &ManifestFormat) -> Result<Vec<Rc<str>>>[src]

Expects value to be array, outputs manifested values

pub fn manifest(&self, ty: &ManifestFormat) -> Result<Rc<str>>[src]

pub fn to_json(&self, padding: usize) -> Result<Rc<str>>[src]

For manifestification

pub fn to_std_json(&self, padding: usize) -> Result<Rc<str>>[src]

Calls std.manifestJson

pub fn to_yaml(&self, padding: usize) -> Result<Rc<str>>[src]

Trait Implementations

impl Clone for Val[src]

impl Debug for Val[src]

impl<'_> From<&'_ Value> for Val[src]

impl<'_> TryFrom<&'_ Val> for Value[src]

type Error = LocError

The type returned in the event of a conversion error.

Auto Trait Implementations

impl !RefUnwindSafe for Val

impl !Send for Val

impl !Sync for Val

impl Unpin for Val

impl !UnwindSafe for Val

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.