pub struct Parser<'src> { /* private fields */ }Expand description
Pull-based event parser for Styx.
Implementations§
Source§impl<'src> Parser<'src>
impl<'src> Parser<'src>
Sourcepub fn new_expr(source: &'src str) -> Self
pub fn new_expr(source: &'src str) -> Self
Create a new parser in expression mode.
Expression mode parses a single value rather than a document with implicit root object. Use this for parsing embedded values like default values in schemas.
Sourcepub fn next_event(&mut self) -> Option<Event<'src>>
pub fn next_event(&mut self) -> Option<Event<'src>>
Get the next event from the parser.
Sourcepub fn parse_to_vec(self) -> Vec<Event<'src>>
pub fn parse_to_vec(self) -> Vec<Event<'src>>
Parse all events into a vector.
Trait Implementations§
Auto Trait Implementations§
impl<'src> Freeze for Parser<'src>
impl<'src> RefUnwindSafe for Parser<'src>
impl<'src> Send for Parser<'src>
impl<'src> Sync for Parser<'src>
impl<'src> Unpin for Parser<'src>
impl<'src> UnsafeUnpin for Parser<'src>
impl<'src> UnwindSafe for Parser<'src>
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