pub struct Parser { /* private fields */ }
Expand description
Low-level XML Parser
The Parser
converts crate::lexer::Token
s into Event
s.
It is a low-level interface which expects to be driven from a TokenRead
source.
Implementations
sourceimpl Parser
impl Parser
pub fn with_context(ctx: RcPtr<Context>) -> Self
sourcepub fn parse<'r, R: TokenRead>(&mut self, r: &'r mut R) -> Result<Option<Event>>
pub fn parse<'r, R: TokenRead>(&mut self, r: &'r mut R) -> Result<Option<Event>>
Parse a single event using tokens from r
.
If the end of file has been reached after a well-formed document,
None
is returned. Otherwise, if the document is still will-formed,
the next Event
is returned.
If the document violates a well-formedness constraint, the XML 1.0 grammar or namespacing rules, the corresponding error is returned.
Errors from the token source (such as I/O errors) are forwarded.
Note: Exchanging the token source between calls to
Parser::parse()
is possible, but not advisible.
sourcepub fn release_temporaries(&mut self)
pub fn release_temporaries(&mut self)
Release all temporary buffers
This is sensible to call when it is expected that no more data will be processed by the parser for a while and the memory is better used elsewhere.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Parser
impl Send for Parser
impl Sync for Parser
impl Unpin for Parser
impl !UnwindSafe for Parser
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more