Skip to main content

EditorConfigSection

Struct EditorConfigSection 

Source
pub struct EditorConfigSection { /* private fields */ }
Expand description

A section in an EditorConfig file.

Each section corresponds to a glob pattern and contains settings for files matching that pattern.

§Example

use cuenv_editorconfig::EditorConfigSection;

let section = EditorConfigSection::new()
    .indent_style("space")
    .indent_size(4)
    .end_of_line("lf")
    .charset("utf-8")
    .insert_final_newline(true)
    .trim_trailing_whitespace(true);

Implementations§

Source§

impl EditorConfigSection

Source

pub fn new() -> Self

Create a new empty section.

Source

pub fn indent_style(self, style: impl Into<String>) -> Self

Set the indentation style.

Valid values: “tab”, “space”

Source

pub fn indent_style_opt(self, style: Option<impl Into<String>>) -> Self

Set the indentation style from an optional value.

Source

pub fn indent_size(self, size: u32) -> Self

Set the indentation size.

Source

pub fn indent_size_tab(self) -> Self

Set the indentation size to “tab”.

Source

pub fn indent_size_opt(self, size: Option<EditorConfigValue>) -> Self

Set the indentation size from an optional value.

Source

pub fn tab_width(self, width: u32) -> Self

Set the tab width.

Source

pub fn tab_width_opt(self, width: Option<u32>) -> Self

Set the tab width from an optional value.

Source

pub fn end_of_line(self, eol: impl Into<String>) -> Self

Set the line ending style.

Valid values: “lf”, “crlf”, “cr”

Source

pub fn end_of_line_opt(self, eol: Option<impl Into<String>>) -> Self

Set the line ending style from an optional value.

Source

pub fn charset(self, charset: impl Into<String>) -> Self

Set the character encoding.

Valid values: “utf-8”, “utf-8-bom”, “utf-16be”, “utf-16le”, “latin1”

Source

pub fn charset_opt(self, charset: Option<impl Into<String>>) -> Self

Set the character encoding from an optional value.

Source

pub fn trim_trailing_whitespace(self, trim: bool) -> Self

Set whether to trim trailing whitespace.

Source

pub fn trim_trailing_whitespace_opt(self, trim: Option<bool>) -> Self

Set whether to trim trailing whitespace from an optional value.

Source

pub fn insert_final_newline(self, insert: bool) -> Self

Set whether to insert a final newline.

Source

pub fn insert_final_newline_opt(self, insert: Option<bool>) -> Self

Set whether to insert a final newline from an optional value.

Source

pub fn max_line_length(self, length: u32) -> Self

Set the maximum line length.

Source

pub fn max_line_length_off(self) -> Self

Set the maximum line length to “off”.

Source

pub fn max_line_length_opt(self, length: Option<EditorConfigValue>) -> Self

Set the maximum line length from an optional value.

Source

pub fn is_empty(&self) -> bool

Check if this section has any settings.

Trait Implementations§

Source§

impl Clone for EditorConfigSection

Source§

fn clone(&self) -> Self

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 EditorConfigSection

Source§

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

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

impl Default for EditorConfigSection

Source§

fn default() -> Self

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

impl Eq for EditorConfigSection

Source§

impl PartialEq for EditorConfigSection

Source§

fn eq(&self, other: &Self) -> 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 EditorConfigSection

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

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 = !

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

fn try_from(value: U) -> Result<T, !>

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