Skip to main content

Iterator

Struct Iterator 

Source
pub struct Iterator<'a> { /* private fields */ }
Expand description

Provides access to the current JSON value during scanning.

Implementations§

Source§

impl<'a> Iterator<'a>

Source

pub fn level(&self) -> usize

Depth level of the current value (0 = root).

Source

pub fn array_index(&self) -> isize

Array index of current element, or -1 if not inside an array.

Source

pub fn value_type(&self) -> ValueType

The type of the current value.

Source

pub fn value_index(&self) -> usize

Start index of the current value in the source.

Source

pub fn value_index_end(&self) -> isize

End index of the current value in the source. Returns -1 for objects and arrays (end unknown during traversal).

Source

pub fn key_index(&self) -> isize

Start index of the object member key in the source, or -1 if not a member.

Source

pub fn key_index_end(&self) -> isize

End index of the object member key in the source, or -1 if not a member.

Source

pub fn key(&self) -> &'a [u8]

The object member key (including quotes), or empty slice if not a member.

Source

pub fn value(&self) -> &'a [u8]

The raw value slice, or empty for objects/arrays.

Source

pub fn value_str(&self) -> &'a str

The raw value as &str. Panics if the source is not valid UTF-8.

Source

pub fn key_str(&self) -> &'a str

The object member key as &str (including quotes), or "" if not a member. Panics if the source is not valid UTF-8.

Source

pub fn pointer(&self) -> String

JSON Pointer (RFC 6901) for the current value.

Source

pub fn write_pointer(&self, buf: &mut Vec<u8>)

Write the JSON Pointer into the provided buffer.

Auto Trait Implementations§

§

impl<'a> Freeze for Iterator<'a>

§

impl<'a> RefUnwindSafe for Iterator<'a>

§

impl<'a> Send for Iterator<'a>

§

impl<'a> Sync for Iterator<'a>

§

impl<'a> Unpin for Iterator<'a>

§

impl<'a> UnsafeUnpin for Iterator<'a>

§

impl<'a> UnwindSafe for Iterator<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.