pub trait EventRead {
type Output;
fn read(&mut self) -> Result<Option<Self::Output>>;
fn read_all<F>(&mut self, cb: F) -> Result<()>
where
F: FnMut(Self::Output),
{ ... }
fn read_all_eof<F>(&mut self, cb: F) -> Result<bool>
where
F: FnMut(Self::Output),
{ ... }
}Expand description
Source for individual XML events
This trait is implemented by the different parser frontends. It is analogous
to the std::io::Read trait, but for XML document events instead of bytes.
Associated Types
Required methods
Read a single event from the parser.
If the EOF has been reached with a valid document, None is returned.
I/O errors may be retried, all other errors are fatal (and will be returned again by the parser on the next invocation without reading further data from the source).
Provided methods
Read all events which can be produced from the data source (at this point in time).
The given cb is invoked for each event.
I/O errors may be retried, all other errors are fatal (and will be returned again by the parser on the next invocation without reading further data from the source).
Read all events which can be produced from the data source (at this point in time).
The given cb is invoked for each event.
If the data source indicates that it needs to block to read further
data, false is returned. If the EOF is reached successfully, true
is returned.
I/O errors may be retried, all other errors are fatal (and will be returned again by the parser on the next invocation without reading further data from the source).