pub struct Value<'dom> { /* private fields */ }Expand description
Value is a node in the DOM tree.
Implementations§
source§impl<'dom> Value<'dom>
impl<'dom> Value<'dom>
sourcepub fn new_f64(val: f64) -> Option<Self>
pub fn new_f64(val: f64) -> Option<Self>
Create a new Value from a f64, if not finite return None.
sourcepub unsafe fn new_f64_unchecked(val: f64) -> Self
pub unsafe fn new_f64_unchecked(val: f64) -> Self
Create a new Value from a f64. Not checking the f64 is finite.
Safety
The f64 must be finite. Because JSON RFC NOT support NaN and Infinity.
sourcepub const fn new_object() -> Self
pub const fn new_object() -> Self
Create a new Value from a empty object
pub fn as_array(&'dom self) -> Option<Array<'dom>>
pub fn as_object(&'dom self) -> Option<Object<'dom>>
pub fn new_str(val: &str, alloc: &'dom Bump) -> Self
pub fn new_str_static(val: &'static str) -> Self
Trait Implementations§
source§impl<'a> JsonValue for Value<'a>
impl<'a> JsonValue for Value<'a>
type ValueType<'dom> = &'dom Value<'dom> where Self: 'dom
source§fn as_number(&self) -> Option<Number>
fn as_number(&self) -> Option<Number>
Returns the
Number value of the JsonValue if it is a Number.source§fn pointer<'dom>(
&'dom self,
path: &JsonPointer<'_>
) -> Option<Self::ValueType<'dom>>
fn pointer<'dom>( &'dom self, path: &JsonPointer<'_> ) -> Option<Self::ValueType<'dom>>
Returns the value from pointer path if the
JsonValue is an array or objectsource§fn get<'dom, I: Index>(&self, index: I) -> Option<Self::ValueType<'_>>
fn get<'dom, I: Index>(&self, index: I) -> Option<Self::ValueType<'_>>
Returns the value from index if the
JsonValue is an array or object
The index may be usize or &str. The usize is for array, the &str is for object.source§fn is_boolean(&self) -> bool
fn is_boolean(&self) -> bool
Returns true if the
JsonValue is a bool.Auto Trait Implementations§
impl<'dom> !RefUnwindSafe for Value<'dom>
impl<'dom> !Send for Value<'dom>
impl<'dom> !Sync for Value<'dom>
impl<'dom> Unpin for Value<'dom>
impl<'dom> !UnwindSafe for Value<'dom>
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