pub struct JsonParser<I>{ /* 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§
Source§impl<I: Iterator<Item = char>> JsonParser<I>
impl<I: Iterator<Item = char>> JsonParser<I>
Sourcepub fn new(it: I) -> Self
pub fn new(it: I) -> Self
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.
Sourcepub fn parse(&mut self) -> JsonParseResult
pub fn parse(&mut self) -> JsonParseResult
Run the parser to parse one JSON value.
Auto Trait Implementations§
impl<I> Freeze for JsonParser<I>where
I: Freeze,
impl<I> RefUnwindSafe for JsonParser<I>where
I: RefUnwindSafe,
impl<I> Send for JsonParser<I>where
I: Send,
impl<I> Sync for JsonParser<I>where
I: Sync,
impl<I> Unpin for JsonParser<I>where
I: Unpin,
impl<I> UnwindSafe for JsonParser<I>where
I: UnwindSafe,
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