pub enum Value {
Undefined,
Null,
Bool(bool),
Num(f64),
Str(String),
BigInt(BigInt),
Arr(Vec<Value>),
Obj(Map),
Date(i64),
Func(u64),
}Expand description
A value under validation, or produced by it.
Variants§
Undefined
No value at all: a missing property, an absent argument. JavaScript’s
undefined, which JSON cannot carry.
Null
A present null.
Bool(bool)
Num(f64)
Every number is a double, as in JavaScript; NaN is a number here.
Str(String)
BigInt(BigInt)
Arr(Vec<Value>)
Obj(Map)
Date(i64)
A date, as milliseconds since the epoch, as a JavaScript Date holds it.
Func(u64)
A function value: opaque, identified so two can be told apart.
Implementations§
Source§impl Value
impl Value
pub fn is_undefined(&self) -> bool
pub fn is_null(&self) -> bool
Sourcepub fn type_of(&self) -> &'static str
pub fn type_of(&self) -> &'static str
The typeof of the value as JavaScript reports it (undefined and
null both read as “value” in messages; see value_kind).
pub fn as_obj(&self) -> Option<&Map>
pub fn as_arr(&self) -> Option<&Vec<Value>>
pub fn as_str(&self) -> Option<&str>
pub fn as_f64(&self) -> Option<f64>
Trait Implementations§
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
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