pub struct Formatter<'a> {
pub printer: &'a mut Printer,
pub settings: &'a FormatterSettings,
/* private fields */
}
Fields§
§printer: &'a mut Printer
§settings: &'a FormatterSettings
Implementations§
Source§impl Formatter<'_>
impl Formatter<'_>
pub fn attribute( &mut self, attribute: &NodeAttribute, next_attribute: Option<&NodeAttribute>, )
Source§impl Formatter<'_>
impl Formatter<'_>
pub fn string(&mut self, string: &str, start_column: usize)
pub fn source_code<T: Spanned>(&mut self, span: &T)
pub fn literal_str(&mut self, lit_str: &LitStr)
pub fn node_value_block_expr( &mut self, block: &Block, unwrap_single_expr_blocks: bool, unwrap_single_lit_blocks: bool, )
pub fn node_value_expr( &mut self, value: &Expr, unwrap_single_expr_blocks: bool, unwrap_single_lit_blocks: bool, formatter: Option<ExpressionFormatter>, )
Source§impl Formatter<'_>
impl Formatter<'_>
pub fn node(&mut self, node: &Node)
pub fn comment(&mut self, comment: &NodeComment)
pub fn doctype(&mut self, doctype: &NodeDoctype)
pub fn node_text(&mut self, text: &NodeText)
pub fn raw_text(&mut self, raw_text: &RawText, use_source_text: bool)
pub fn node_name(&mut self, name: &NodeName)
pub fn node_block(&mut self, block: &NodeBlock)
Source§impl<'a> Formatter<'a>
impl<'a> Formatter<'a>
pub fn new(settings: &'a FormatterSettings, printer: &'a mut Printer) -> Self
pub fn with_source( settings: &'a FormatterSettings, printer: &'a mut Printer, source: &'a Rope, comments: HashMap<usize, Option<String>>, ) -> Self
pub fn trim_whitespace(&mut self, line_index: usize)
pub fn flush_comments( &mut self, line_index: usize, skip_trailing_whitespace: bool, )
pub fn format_syn_pat(&mut self, pat: &Pat)
pub fn format_syn_generics(&mut self, generics: &Generics)
Auto Trait Implementations§
impl<'a> Freeze for Formatter<'a>
impl<'a> RefUnwindSafe for Formatter<'a>
impl<'a> Send for Formatter<'a>
impl<'a> Sync for Formatter<'a>
impl<'a> Unpin for Formatter<'a>
impl<'a> !UnwindSafe for Formatter<'a>
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