pub struct JsonParser<'tk> { /* private fields */ }Implementations§
Source§impl<'tk> JsonParser<'tk>
impl<'tk> JsonParser<'tk>
Sourcepub fn new(src: &'tk str) -> Self
pub fn new(src: &'tk str) -> Self
Examples found in repository?
examples/deserialize_into_struct.rs (lines 13-17)
12fn main() -> jsode::Result<()> {
13 let mut src = JsonParser::new(r#"{
14 'r': 255,
15 'b': 96,
16 'green': 0,
17 }"#);
18 let ast = src.parse()?;
19
20 let expected = Color {
21 red: 255,
22 blue: 96,
23 green: 0,
24 };
25 assert_eq!(expected, ast.parse_into::<Color>()?);
26
27 Ok(())
28}Source§impl<'tk> JsonParser<'tk>
impl<'tk> JsonParser<'tk>
Sourcepub fn parse(&mut self) -> Result<JsonOutput<'_>>
pub fn parse(&mut self) -> Result<JsonOutput<'_>>
Examples found in repository?
examples/deserialize_into_struct.rs (line 18)
12fn main() -> jsode::Result<()> {
13 let mut src = JsonParser::new(r#"{
14 'r': 255,
15 'b': 96,
16 'green': 0,
17 }"#);
18 let ast = src.parse()?;
19
20 let expected = Color {
21 red: 255,
22 blue: 96,
23 green: 0,
24 };
25 assert_eq!(expected, ast.parse_into::<Color>()?);
26
27 Ok(())
28}Source§impl<'tk> JsonParser<'tk>
impl<'tk> JsonParser<'tk>
Trait Implementations§
Source§impl<'tk> Debug for JsonParser<'tk>
impl<'tk> Debug for JsonParser<'tk>
Source§impl<'tk> PartialEq for JsonParser<'tk>
impl<'tk> PartialEq for JsonParser<'tk>
impl<'tk> StructuralPartialEq for JsonParser<'tk>
Auto Trait Implementations§
impl<'tk> Freeze for JsonParser<'tk>
impl<'tk> RefUnwindSafe for JsonParser<'tk>
impl<'tk> !Send for JsonParser<'tk>
impl<'tk> !Sync for JsonParser<'tk>
impl<'tk> Unpin for JsonParser<'tk>
impl<'tk> UnwindSafe for JsonParser<'tk>
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