pub trait Parse {
type Output;
fn parse<R: TokenRead>(&mut self, r: &mut R) -> Result<Option<Self::Output>>;
fn release_temporaries(&mut self);
}Expand description
Trait for parser-like structs.
Required Associated Types
Required Methods
Parse a single event using tokens from r.
If the end of file has been reached after a document accepted by the
parser, None is returned. Otherwise, if the document is still
acceptable the next XML event is returned.
If the document violates a constraint, such as 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 parse() is
possible, but not advisible (if the token source represents a
different document).
fn release_temporaries(&mut self)
fn release_temporaries(&mut self)
Release all temporary buffers or other ephemeral allocations
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.