Struct norad::WriteOptions
source · pub struct WriteOptions { /* private fields */ }
Expand description
Options that can be set when writing the UFO to disk.
You construct WriteOptions
using builder semantics:
let single_tab = WriteOptions::default();
let two_tabs = WriteOptions::default()
.whitespace("\t\t");
let spaces = WriteOptions::default()
.whitespace(" ");
let spaces_and_singlequotes = WriteOptions::default()
.whitespace(" ")
.quote_char(QuoteChar::Single);
Implementations§
source§impl WriteOptions
impl WriteOptions
sourcepub fn whitespace(self, indent_str: impl Into<Cow<'static, str>>) -> Self
👎Deprecated since 0.8.1: use ‘indent’ method instead
pub fn whitespace(self, indent_str: impl Into<Cow<'static, str>>) -> Self
deprecated. Use WriteOptions::indent
instead.
Builder-style method to customize the whitespace.
By default, we indent with a single tab (“\t”).
The argument, may be either a 'static str
or a String
. You should
prefer to use a 'static str
where possible.
The string can contain any number of a single ASCII character, but must not contain multiple different characters. As an example, “\t\t” is fine, but “\t \t” is not, because it contains both tabs and spaces.
§Panics
Panics if the provided string is empty, or if it contains multiple different characters.
sourcepub fn indent(self, indent_char: u8, indent_count: usize) -> Self
pub fn indent(self, indent_char: u8, indent_count: usize) -> Self
Customize the indent whitespace.
By default, we indent with a single tab (\t
). You can use this method
to specify alternative indent behaviour.
§Panics
Panics if the provided indent_char
is not one of 0x09 (tab) or 0x20 (space).
§Example
Indenting with four spaces:
use norad::WriteOptions;
let options = WriteOptions::new().indent(WriteOptions::SPACE, 4);
sourcepub fn quote_char(self, quote_style: QuoteChar) -> Self
pub fn quote_char(self, quote_style: QuoteChar) -> Self
Builder-style method to customize the XML declaration attribute definition quote char.
By default, we indent with double quotes.
The quote style is defined with a QuoteChar
enum argument.
sourcepub fn xml_options(&self) -> &XmlWriteOptions
pub fn xml_options(&self) -> &XmlWriteOptions
Return a reference to XmlWriteOptions
for use with the plist
crate.
Trait Implementations§
source§impl Clone for WriteOptions
impl Clone for WriteOptions
source§fn clone(&self) -> WriteOptions
fn clone(&self) -> WriteOptions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more