Struct Config

Source
pub struct Config {
    pub syntax: LuaVersion,
    pub column_width: usize,
    pub line_endings: LineEndings,
    pub indent_type: IndentType,
    pub indent_width: usize,
    pub quote_style: QuoteStyle,
    pub no_call_parentheses: bool,
    pub call_parentheses: CallParenType,
    pub collapse_simple_statement: CollapseSimpleStatement,
    pub sort_requires: SortRequiresConfig,
    pub space_after_function_names: SpaceAfterFunctionNames,
}
Expand description

The configuration to use when formatting.

Fields§

§syntax: LuaVersion

The type of Lua syntax to parse.

§column_width: usize

The approximate line length to use when printing the code. This is used as a guide to determine when to wrap lines, but note that this is not a hard upper bound.

§line_endings: LineEndings

The type of line endings to use.

§indent_type: IndentType

The type of indents to use.

§indent_width: usize

The width of a single indentation level. If indent_type is set to IndentType::Spaces, then this is the number of spaces to use. If indent_type is set to IndentType::Tabs, then this is used as a heuristic to guide when to wrap lines.

§quote_style: QuoteStyle

The style of quotes to use in string literals.

§no_call_parentheses: bool
👎Deprecated: use call_parentheses instead

Whether to omit parentheses around function calls which take a single string literal or table. This is added for adoption reasons only, and is not recommended for new work.

§call_parentheses: CallParenType

When to use call parentheses. if call_parentheses is set to CallParenType::Always call parentheses is always applied. if call_parentheses is set to CallParenType::NoSingleTable call parentheses is omitted when function is called with only one string argument. if call_parentheses is set to CallParenType::NoSingleTable call parentheses is omitted when function is called with only one table argument. if call_parentheses is set to CallParenType::None call parentheses is omitted when function is called with only one table or string argument (same as no_call_parentheses).

§collapse_simple_statement: CollapseSimpleStatement

Whether we should collapse simple structures like functions or guard statements if set to [CollapseSimpleStatement::None] structures are never collapsed. if set to CollapseSimpleStatement::FunctionOnly then simple functions (i.e., functions with a single laststmt) can be collapsed

§sort_requires: SortRequiresConfig

Configuration for the sort requires codemod

§space_after_function_names: SpaceAfterFunctionNames

Whether we should include a space between the function name and arguments.

Implementations§

Source§

impl Config

Source

pub fn new() -> Self

Creates a new Config with the default values

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

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 Config

Source§

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

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

impl Default for Config

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Config
where Config: Default,

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 Copy for Config

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

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

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