pub struct LazyValue<'de> { /* private fields */ }Expand description
LazyValue is a raw value from json text. Mainly used for get few values from json fastly.
LazyValue is only generated when using get for Iterator.
Implementations§
source§impl<'de> LazyValue<'de>
impl<'de> LazyValue<'de>
pub fn deserialize<T: Deserialize<'de>>(&'de self) -> Result<T>
sourcepub fn as_raw_slice(&self) -> &[u8] ⓘ
pub fn as_raw_slice(&self) -> &[u8] ⓘ
export the raw json text as slice
sourcepub fn as_raw_str(&self) -> &str
pub fn as_raw_str(&self) -> &str
export the raw json text as str
sourcepub fn as_raw_bytes(&self) -> Bytes
pub fn as_raw_bytes(&self) -> Bytes
export the raw json text as bytes Note: if the input json is not bytes or faststr, there will be a copy.
sourcepub fn as_raw_faststr(&self) -> FastStr
pub fn as_raw_faststr(&self) -> FastStr
export the raw json text as faststr Note: if the input json is not bytes or faststr, there will be a copy.
pub fn into_cow_str(self) -> Result<Cow<'de, str>>
Trait Implementations§
source§impl<'de> JsonValue for LazyValue<'de>
impl<'de> JsonValue for LazyValue<'de>
type ValueType<'dom> = LazyValue<'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 get<I: Index>(&self, index: I) -> Option<Self::ValueType<'_>>
fn get<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 pointer(&self, path: &JsonPointer<'_>) -> Option<Self::ValueType<'_>>
fn pointer(&self, path: &JsonPointer<'_>) -> Option<Self::ValueType<'_>>
Returns the value from pointer path if the
JsonValue is an array or objectsource§fn is_boolean(&self) -> bool
fn is_boolean(&self) -> bool
Returns true if the
JsonValue is a bool.Auto Trait Implementations§
impl<'de> !RefUnwindSafe for LazyValue<'de>
impl<'de> Send for LazyValue<'de>
impl<'de> !Sync for LazyValue<'de>
impl<'de> Unpin for LazyValue<'de>
impl<'de> UnwindSafe for LazyValue<'de>
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