pub struct WriteOptions { /* private fields */ }
Expand description

A struct that define write options.

Implementations§

Define which xml prolog will be displayed when rendering an Element.

Note that prolog is optional, an XML document with a missing prolog is well-formed but not valid.

See RFC: W3C XML 26 November 2008

Line separator used to separate lines in formatted output. Default is "\n".

A string which will be used for a single level of indentation. Default is " " (two spaces).

Whether or not the emitted document should be indented. Default is false.

The emitter is capable to perform automatic indentation of the emitted XML document. It is done in stream-like fashion and does not require the knowledge of the whole document in advance.

Sometimes, however, automatic indentation is undesirable, e.g. when you want to keep existing layout when processing an existing XML document. Also the indentiation algorithm is not thoroughly tested. Hence by default it is disabled.

Whether or not to convert elements with empty content to empty elements. Default is true.

This option allows turning elements like <a></a> (an element with empty content) into <a /> (an empty element).

Whether or not to emit CDATA events as plain characters. Default is false.

This option forces the emitter to convert CDATA events into regular character events, performing all the necessary escaping beforehand. This may be occasionally useful for feeding the document into incorrect parsers which do not support CDATA.

Whether or not to automatically insert spaces before the trailing /> in self-closing elements. Default is true.

This option is only meaningful if normalize_empty_elements is true. For example, the element <a></a> would be unaffected. When normalize_empty_elements is true, then when this option is also true, the same element would appear <a />. If this option is false, then the same element would appear <a/>.

Whether or not to automatically insert leading and trailing spaces in emitted comments, if necessary. Default is true.

This is a convenience option in order for the user not to append spaces before and after comments text in order to get more pretty comments: <!-- something --> instead of <!--something-->.

Trait Implementations§

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.