pub struct FormatterOptions {
pub preserve_comments: bool,
pub parenthesize_expressions: bool,
pub annotate_types: bool,
pub signature_roots: Option<Vec<SyntaxNode>>,
pub canonical_format: bool,
pub indent_style: IndentStyle,
pub brace_style: BraceStyle,
pub semicolon_style: SemicolonStyle,
}Expand description
Options for printing the syntax tree.
Fields§
§preserve_comments: boolInclude trivia (whitespace, comments) in the output. If false, only semantic tokens are emitted.
parenthesize_expressions: boolWrap expressions in parentheses to make precedence explicit (e.g. a + b + c * d → ((a + b) + (c * d))).
annotate_types: boolAdd block comments /* type */ with the inferred type after expressions and variables.
signature_roots: Option<Vec<SyntaxNode>>When annotate_types is true, use these signature roots (e.g. stdlib) so built-in function/global types are inferred.
canonical_format: boolWhen true, normalize layout: indentation, brace style, semicolons. Ignores source whitespace/comment layout.
indent_style: IndentStyleIndentation for canonical format (tabs or N spaces).
brace_style: BraceStyleBrace placement for canonical format.
semicolon_style: SemicolonStyleSemicolon placement for canonical format.
Trait Implementations§
Source§impl Clone for FormatterOptions
impl Clone for FormatterOptions
Source§fn clone(&self) -> FormatterOptions
fn clone(&self) -> FormatterOptions
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FormatterOptions
impl Debug for FormatterOptions
Auto Trait Implementations§
impl Freeze for FormatterOptions
impl RefUnwindSafe for FormatterOptions
impl Send for FormatterOptions
impl Sync for FormatterOptions
impl Unpin for FormatterOptions
impl UnsafeUnpin for FormatterOptions
impl UnwindSafe for FormatterOptions
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