pub struct Resolved<'s, A: Allocator = Global> { /* private fields */ }Expand description
A JsonView node paired with the source it was parsed from, so string values resolve and keyed navigation work
without threading source through every call. Copy, so it chains freely: view.bind(src).get("a").get(0).
Implementations§
Source§impl<'s, A: Allocator> Resolved<'s, A>
impl<'s, A: Allocator> Resolved<'s, A>
Sourcepub fn as_i64(self) -> Option<i64>
pub fn as_i64(self) -> Option<i64>
The value as an i64, on the same terms as JsonView::as_i64.
Sourcepub fn as_u64(self) -> Option<u64>
pub fn as_u64(self) -> Option<u64>
The value as a u64, on the same terms as JsonView::as_u64.
Sourcepub fn as_f64(self) -> Option<f64>
pub fn as_f64(self) -> Option<f64>
The value as an f64. Unlike JsonView::as_f64, this cursor carries its source, so it can also approximate a
BigNumber — the one place where binding to the source widens what is readable. A
magnitude f64 cannot hold at all yields None; read it through as_number_str.
Sourcepub fn as_str(self) -> Option<&'s str>
pub fn as_str(self) -> Option<&'s str>
The string value, resolved against source (still escaped).
Sourcepub fn as_number_str(self) -> Option<&'s str>
pub fn as_number_str(self) -> Option<&'s str>
The exact decimal text of a big integer that overflowed 64 bits, or None.
Sourcepub fn is_boolean(self) -> bool
pub fn is_boolean(self) -> bool
Whether this is true or false.
Sourcepub fn is_number(self) -> bool
pub fn is_number(self) -> bool
Whether this is a number of any lane, including one too wide for 64 bits.
Sourcepub fn is_empty(self) -> bool
pub fn is_empty(self) -> bool
Whether an array or object has no elements. Always false for scalars.
Sourcepub fn get<K: ResolveKey<A>>(self, key: K) -> Resolved<'s, A>
pub fn get<K: ResolveKey<A>>(self, key: K) -> Resolved<'s, A>
Navigates to a child by &str key or usize index, returning a Null-backed cursor on a miss so lookups chain
without ?.
Sourcepub fn try_get<K: ResolveKey<A>>(self, key: K) -> Option<Resolved<'s, A>>
pub fn try_get<K: ResolveKey<A>>(self, key: K) -> Option<Resolved<'s, A>>
Like get but distinguishes a miss with None.
Sourcepub fn entries(self) -> impl Iterator<Item = (&'s str, Resolved<'s, A>)>
pub fn entries(self) -> impl Iterator<Item = (&'s str, Resolved<'s, A>)>
Iterates an object’s entries as (key, value cursor).
Sourcepub fn elements(self) -> impl Iterator<Item = Resolved<'s, A>>
pub fn elements(self) -> impl Iterator<Item = Resolved<'s, A>>
Iterates an array’s elements as cursors.
Sourcepub fn pointer(self, pointer: &str) -> Resolved<'s, A>
pub fn pointer(self, pointer: &str) -> Resolved<'s, A>
Resolves an RFC 6901 JSON Pointer, returning a Null-backed cursor on a miss.
Sourcepub fn try_pointer(self, pointer: &str) -> Option<Resolved<'s, A>>
pub fn try_pointer(self, pointer: &str) -> Option<Resolved<'s, A>>
Like pointer but distinguishes a miss with None.
Sourcepub fn write_json<W: Write>(self, writer: &mut W) -> Result
pub fn write_json<W: Write>(self, writer: &mut W) -> Result
Writes this node as compact JSON, no source argument needed.