Enum jrsonnet_evaluator::Val[][src]

pub enum Val {
    Bool(bool),
    Null,
    Str(IStr),
    Num(f64),
    Arr(ArrValue),
    Obj(ObjValue),
    Func(Rc<FuncVal>),
}

Variants

Bool(bool)
Null
Str(IStr)
Num(f64)
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 unwrap_num(self) -> Result<f64>[src]

pub fn unwrap_func(self) -> Result<Rc<FuncVal>>[src]

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

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

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

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

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

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

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

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

Expects value to be array, outputs manifested values

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

pub fn to_json(&self, padding: usize) -> Result<IStr>[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<IStr>[src]

Trait Implementations

impl Clone for Val[src]

impl Debug for Val[src]

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

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.