pub struct FormatOptions { /* private fields */ }Expand description
Formatter behavior switches.
Prefer Default, FormatOptions::new, or the with_* helpers when
constructing options so new fields can ship with defaults without breaking
call sites.
§Examples
use daml_fmt::{FormatOptions, ImportOrder};
let from_default = FormatOptions::default();
let preserved = FormatOptions::new().with_import_order(ImportOrder::Preserve);
assert_eq!(preserved.import_order(), ImportOrder::Preserve);
assert_ne!(from_default.import_order(), preserved.import_order());Implementations§
Source§impl FormatOptions
impl FormatOptions
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Create formatter options with the default organizing configuration.
This is equivalent to Default::default and currently uses
ImportOrder::Organize.
Sourcepub const fn import_order(self) -> ImportOrder
pub const fn import_order(self) -> ImportOrder
How the formatter handles import declarations.
ImportOrder::Organizegroups/sorts imports into canonical formatter order.ImportOrder::Preservekeeps original declaration order.
Reordering imports can change package identity even when the source-level
declarations denote the same imports; use --preserve-import-order in the
CLI when package identity stability matters more than import organization.
Sourcepub const fn rules(self) -> FormatRuleSet
pub const fn rules(self) -> FormatRuleSet
Formatter rules enabled for this formatting run.
Sourcepub const fn with_rules(self, rules: FormatRuleSet) -> Self
pub const fn with_rules(self, rules: FormatRuleSet) -> Self
Set the formatter rules enabled for this formatting run.
Sourcepub const fn with_import_order(self, import_order: ImportOrder) -> Self
pub const fn with_import_order(self, import_order: ImportOrder) -> Self
Set the import ordering strategy.
See FormatOptions::import_order for the package-identity warning
when imports are reordered.
Trait Implementations§
Source§impl Clone for FormatOptions
impl Clone for FormatOptions
Source§fn clone(&self) -> FormatOptions
fn clone(&self) -> FormatOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for FormatOptions
Source§impl Debug for FormatOptions
impl Debug for FormatOptions
Source§impl Default for FormatOptions
impl Default for FormatOptions
Source§fn default() -> FormatOptions
fn default() -> FormatOptions
impl Eq for FormatOptions
Source§impl PartialEq for FormatOptions
impl PartialEq for FormatOptions
Source§fn eq(&self, other: &FormatOptions) -> bool
fn eq(&self, other: &FormatOptions) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for FormatOptions
Auto Trait Implementations§
impl Freeze for FormatOptions
impl RefUnwindSafe for FormatOptions
impl Send for FormatOptions
impl Sync for FormatOptions
impl Unpin for FormatOptions
impl UnsafeUnpin for FormatOptions
impl UnwindSafe for FormatOptions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.