Struct alfred::xml::XMLWriter [] [src]

pub struct XMLWriter<W: Write> { /* fields omitted */ }

Helper struct used to manage the XML serialization of Items.

When the XMLWriter is first created, the XML header is immediately written. When the XMLWriter is dropped, the XML footer is written and the Write is flushed.

Any errors produced by writing the footer are silently ignored. The close() method can be used to return any such error.

Methods

impl<W: Write> XMLWriter<W>
[src]

[src]

Returns a new XMLWriter that writes to the given Write.

The XML header is written immediately.

[src]

Writes an Item to the underlying Write.

If a previous write produced an error, any subsequent write will do nothing and return the same error. This is because the previous write may have partially completed, and attempting to write any more data will be unlikely to work properly.

[src]

Consumes the XMLWriter and writes the XML footer.

This method can be used to get any error resulting from writing the footer. If this method is not used, the footer will be written when the XMLWriter is dropped and any error will be silently ignored.

As with write_item(), if a previous invocation of write_item() returned an error, close() will return the same error without attempting to write the XML footer.

When this method is used, the XML footer is written, but the Write is not flushed. When the XMLWriter is dropped without calling close(), the Write is flushed after the footer is written.

Trait Implementations

impl<W: Write> Drop for XMLWriter<W>
[src]

[src]

Executes the destructor for this type. Read more