Skip to main content

FormatOptions

Struct FormatOptions 

Source
pub struct FormatOptions {
    pub indent_width: usize,
    pub insert_spaces: bool,
    pub max_inline_tag_width: usize,
    pub attribute_sort: AttributeSort,
    pub attribute_layout: AttributeLayout,
    pub attributes_per_line: usize,
    pub space_before_self_close: bool,
    pub quote_style: QuoteStyle,
    pub wrapped_attribute_indent: WrappedAttributeIndent,
    pub text_content: TextContentMode,
    pub blank_lines: BlankLines,
    pub ignore_prefixes: Vec<String>,
}
Expand description

Formatter configuration for SVG pretty-printing.

§Examples

let options = svg_format::FormatOptions::default();
assert_eq!(options.indent_width, 2);

Fields§

§indent_width: usize

Number of spaces per indentation level when insert_spaces is true.

§insert_spaces: bool

Whether indentation should use spaces (true) or tabs (false).

§max_inline_tag_width: usize

Maximum inline tag width before switching to multi-line attributes.

§attribute_sort: AttributeSort

Attribute ordering mode.

§attribute_layout: AttributeLayout

Attribute wrapping mode.

§attributes_per_line: usize

Maximum number of attributes emitted per wrapped line.

§space_before_self_close: bool

Emit a space before /> in self-closing tags.

§quote_style: QuoteStyle

Preferred quote style for attribute values.

§wrapped_attribute_indent: WrappedAttributeIndent

Indentation style for wrapped attributes.

§text_content: TextContentMode

How text-node whitespace is handled.

§blank_lines: BlankLines

How blank lines between sibling elements are handled.

§ignore_prefixes: Vec<String>

Comment prefixes that trigger ignore directives.

For each prefix p, the formatter recognizes:

  • <!-- p-ignore --> — skip formatting the next sibling
  • <!-- p-ignore-file --> — skip the entire file (detected anywhere)
  • <!-- p-ignore-start --> / <!-- p-ignore-end --> — skip a range

Defaults to ["svg-format"].

Trait Implementations§

Source§

impl Clone for FormatOptions

Source§

fn clone(&self) -> FormatOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FormatOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FormatOptions

Source§

fn default() -> Self

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

impl Eq for FormatOptions

Source§

impl PartialEq for FormatOptions

Source§

fn eq(&self, other: &FormatOptions) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FormatOptions

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.