pub struct EventWriter { /* private fields */ }
Expand description
A wrapper around a String which emits XML document according to provided events.
Implementations§
Source§impl EventWriter
impl EventWriter
Sourcepub fn new() -> EventWriter
pub fn new() -> EventWriter
Creates a new EventWriter
using the default
configuration.
Sourcepub fn new_with_config(config: EmitterConfig) -> EventWriter
pub fn new_with_config(config: EmitterConfig) -> EventWriter
Creates a new EventWriter
using the provided
configuration.
Sourcepub fn write<'a, E>(&mut self, event: E) -> Result<()>
pub fn write<'a, E>(&mut self, event: E) -> Result<()>
Writes the next piece of XML document according to the provided event.
Note that output data may not exactly correspond to the written event because
of various configuration options. For example, XmlEvent::EndElement
may
correspond to a separate closing element or it may cause writing an empty element.
Another example is that XmlEvent::CData
may be represented as characters in
the output stream.
Sourcepub fn inner_mut(&mut self) -> &mut String
pub fn inner_mut(&mut self) -> &mut String
Returns a mutable reference to the underlying String.
Sourcepub fn into_inner(self) -> String
pub fn into_inner(self) -> String
Unwraps this EventWriter
, returning the String the writer has written to.
This is the primary method for retrieving the output of the no-std
writer.