[][src]Enum jst::Val

pub enum Val {
    Str(String),
    Obj(Obj),
    Num(f64),
    Array(Vec<Val>),
    Bool(bool),
    Null,
    Undef,
}

Any Object Value options

The Val enum wrap the values to make the code more readable for example let obj = val! {

}

let result = obj["some key"]["anther key"][2]

even th

Variants

Str(String)
Obj(Obj)
Num(f64)
Array(Vec<Val>)
Bool(bool)
Null
Undef

Methods

impl Val[src]

pub fn parse(str: &str) -> Result<Val, ParserErr>[src]

pub fn unwrap_str(self) -> String[src]

pub fn unwrap_str_or(self, def: String) -> String[src]

pub fn unwrap_num(self) -> f64[src]

pub fn unwrap_num_or(self, def: f64) -> f64[src]

pub fn unwrap_bool(self) -> bool[src]

pub fn unwrap_bool_or(self, def: bool) -> bool[src]

pub fn unwrap_arr(self) -> Vec<Val>[src]

pub fn unwrap_arr_or(self, def: Vec<Val>) -> Vec<Val>[src]

pub fn unwrap_obj(self) -> Obj[src]

pub fn unwrap_obj_or(self, def: Obj) -> Obj[src]

Trait Implementations

impl Clone for Val[src]

impl Debug for Val[src]

impl Display for Val[src]

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

impl From<HashMap<String, Val, RandomState>> for Val[src]

impl From<Obj> for Val[src]

impl From<String> for Val[src]

impl From<Vec<Val>> for Val[src]

impl From<bool> for Val[src]

impl From<f32> for Val[src]

impl From<f64> for Val[src]

impl From<i128> for Val[src]

impl From<i16> for Val[src]

impl From<i32> for Val[src]

impl From<i64> for Val[src]

impl From<i8> for Val[src]

impl From<u128> for Val[src]

impl From<u16> for Val[src]

impl From<u32> for Val[src]

impl From<u64> for Val[src]

impl From<u8> for Val[src]

impl From<usize> for Val[src]

impl<'_> Index<&'_ str> for Val[src]

type Output = Val

The returned type after indexing.

impl Index<usize> for Val[src]

type Output = Val

The returned type after indexing.

impl PartialEq<Val> for Val[src]

impl StructuralPartialEq 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> ToString for T where
    T: Display + ?Sized
[src]

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.