Struct taplo::formatter::Options

source ·
pub struct Options {
Show 19 fields pub align_entries: bool, pub align_comments: bool, pub align_single_comments: bool, pub array_trailing_comma: bool, pub array_auto_expand: bool, pub inline_table_expand: bool, pub array_auto_collapse: bool, pub compact_arrays: bool, pub compact_inline_tables: bool, pub compact_entries: bool, pub column_width: usize, pub indent_tables: bool, pub indent_entries: bool, pub indent_string: String, pub trailing_newline: bool, pub reorder_keys: bool, pub reorder_arrays: bool, pub allowed_blank_lines: usize, pub crlf: bool,
}
Expand description

All the formatting options.

Fields§

§align_entries: bool

Align entries vertically.

Entries that have table headers, comments, or blank lines between them are not aligned.

§align_comments: bool

Align consecutive comments after entries and items vertically.

This applies to comments that are after entries or array items.

§align_single_comments: bool

If align_comments is true, apply the alignment in cases where there’s only one comment.

§array_trailing_comma: bool

Put trailing commas for multiline arrays.

§array_auto_expand: bool

Automatically expand arrays to multiple lines if they’re too long.

§inline_table_expand: bool

Expand values (e.g.) inside inline tables where possible.

§array_auto_collapse: bool

Automatically collapse arrays if they fit in one line.

The array won’t be collapsed if it contains a comment.

§compact_arrays: bool

Omit whitespace padding inside single-line arrays.

§compact_inline_tables: bool

Omit whitespace padding inside inline tables.

§compact_entries: bool

Omit whitespace around =.

§column_width: usize

Target maximum column width after which arrays are expanded into new lines.

This is best-effort and might not be accurate.

§indent_tables: bool

Indent subtables if they come in order.

§indent_entries: bool

Indent entries under tables.

§indent_string: String

Indentation to use, should be tabs or spaces but technically could be anything.

§trailing_newline: bool

Add trailing newline to the source.

§reorder_keys: bool

Alphabetically reorder keys that are not separated by blank lines.

§reorder_arrays: bool

Alphabetically reorder array values that are not separated by blank lines.

§allowed_blank_lines: usize

The maximum amount of consecutive blank lines allowed.

§crlf: bool

Use CRLF line endings

Implementations§

source§

impl Options

source

pub fn update(&mut self, incomplete: OptionsIncomplete)

source

pub fn update_camel(&mut self, incomplete: OptionsIncompleteCamel)

source

pub fn update_from_str<S: AsRef<str>, I: Iterator<Item = (S, S)>>( &mut self, values: I ) -> Result<(), OptionParseError>

Trait Implementations§

source§

impl Clone for Options

source§

fn clone(&self) -> Options

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Options

source§

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

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

impl Default for Options

source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Options

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl JsonSchema for Options

source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
source§

fn json_schema(gen: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
source§

impl PartialEq for Options

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Options

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for Options

source§

impl StructuralPartialEq for Options

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> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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,

§

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>,

§

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>,

§

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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,