pub struct ConfigurationBuilder { /* private fields */ }
Expand description
Formatting configuration builder.
§Example
use dprint_plugin_toml::configuration::*;
let config = ConfigurationBuilder::new()
.line_width(80)
.build();
Implementations§
source§impl ConfigurationBuilder
impl ConfigurationBuilder
sourcepub fn new() -> ConfigurationBuilder
pub fn new() -> ConfigurationBuilder
Constructs a new configuration builder.
sourcepub fn build(&self) -> Configuration
pub fn build(&self) -> Configuration
Gets the final configuration that can be used to format a file.
sourcepub fn global_config(&mut self, global_config: GlobalConfiguration) -> &mut Self
pub fn global_config(&mut self, global_config: GlobalConfiguration) -> &mut Self
Set the global configuration.
sourcepub fn line_width(&mut self, value: u32) -> &mut Self
pub fn line_width(&mut self, value: u32) -> &mut Self
The width of a line the printer will try to stay under. Note that the printer may exceed this width in certain cases. Default: 120
sourcepub fn use_tabs(&mut self, value: bool) -> &mut Self
pub fn use_tabs(&mut self, value: bool) -> &mut Self
Whether to use tabs (true) or spaces (false).
Default: false
sourcepub fn indent_width(&mut self, value: u8) -> &mut Self
pub fn indent_width(&mut self, value: u8) -> &mut Self
The number of columns for an indent.
Default: 2
sourcepub fn new_line_kind(&mut self, value: NewLineKind) -> &mut Self
pub fn new_line_kind(&mut self, value: NewLineKind) -> &mut Self
The kind of newline to use.
Default: NewLineKind::LineFeed
sourcepub fn comment_force_leading_space(&mut self, value: bool) -> &mut Self
pub fn comment_force_leading_space(&mut self, value: bool) -> &mut Self
Forces a leading space after the hashes.
Default: true
sourcepub fn cargo_apply_conventions(&mut self, value: bool) -> &mut Self
pub fn cargo_apply_conventions(&mut self, value: bool) -> &mut Self
Whether to apply sorting to a Cargo.toml file.
Default: true
Trait Implementations§
source§impl Default for ConfigurationBuilder
impl Default for ConfigurationBuilder
source§fn default() -> ConfigurationBuilder
fn default() -> ConfigurationBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ConfigurationBuilder
impl RefUnwindSafe for ConfigurationBuilder
impl Send for ConfigurationBuilder
impl Sync for ConfigurationBuilder
impl Unpin for ConfigurationBuilder
impl UnwindSafe for ConfigurationBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more