Struct tinyjson::JsonParser

source ·
pub struct JsonParser<I>where
    I: Iterator<Item = char>,
{ /* private fields */ }
Expand description

JSON parser to parse UTF-8 string into JsonValue value.

Basically you don’t need to use this struct directly thanks to FromStr trait implementation.

use tinyjson::{JsonParser, JsonValue};

let mut parser = JsonParser::new("[1, 2, 3]".chars());
let array = parser.parse().unwrap();

// Equivalent to the above code using `FromStr`
let array: JsonValue = "[1, 2, 3]".parse().unwrap();

Implementations§

Create a new parser instance from an iterator which iterates characters. The iterator is usually built from str::chars for parsing str or String values.

Run the parser to parse one JSON value.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.