pub enum Val {
Str(String),
Obj(Obj),
Num(f64),
Array(Vec<Val>),
Bool(bool),
Null,
Undef,
}
Expand description
§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§
Implementations§
Source§impl Val
impl Val
pub fn parse(str: &str) -> Result<Val, ParserErr>
pub fn unwrap_str(self) -> String
pub fn unwrap_str_or(self, def: String) -> String
pub fn unwrap_num(self) -> f64
pub fn unwrap_num_or(self, def: f64) -> f64
pub fn unwrap_bool(self) -> bool
pub fn unwrap_bool_or(self, def: bool) -> bool
pub fn unwrap_arr(self) -> Vec<Val>
pub fn unwrap_arr_or(self, def: Vec<Val>) -> Vec<Val>
pub fn unwrap_obj(self) -> Obj
pub fn unwrap_obj_or(self, def: Obj) -> Obj
Trait Implementations§
impl StructuralPartialEq for Val
Auto Trait Implementations§
impl Freeze for Val
impl RefUnwindSafe for Val
impl Send for Val
impl Sync for Val
impl Unpin for Val
impl UnwindSafe for Val
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