pub struct Value { /* private fields */ }Expand description
A value read from the input.
This can be any of the following types:
- boolean
- number
- string
- null
- object
- array
- error
Implementations§
Source§impl Value
impl Value
Sourcepub fn intern_utf8_str(&self, s: &str) -> InternedStringId
pub fn intern_utf8_str(&self, s: &str) -> InternedStringId
Intern a string. This is just a convenience method equivalent to calling Context::intern_utf8_str, if you don’t have a Context easily accessible.
Sourcepub fn as_number(&self) -> Option<f64>
pub fn as_number(&self) -> Option<f64>
Get the value as a number, if it is one. Note that this will apply to both integers and floats.
Sourcepub fn get_obj_prop(&self, prop: &str) -> Self
pub fn get_obj_prop(&self, prop: &str) -> Self
Get a property from the object.
Sourcepub fn get_interned_obj_prop(
&self,
interned_string_id: InternedStringId,
) -> Self
pub fn get_interned_obj_prop( &self, interned_string_id: InternedStringId, ) -> Self
Get a property from the object by its interned string ID.
Sourcepub fn get_at_index(&self, index: usize) -> Self
pub fn get_at_index(&self, index: usize) -> Self
Get an element from the array or object by its index.
Sourcepub fn get_obj_key_at_index(&self, index: usize) -> Option<String>
pub fn get_obj_key_at_index(&self, index: usize) -> Option<String>
Get the key of an object by its index.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin 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