Struct Formatter

Source
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<'_>

Source

pub fn attribute( &mut self, attribute: &NodeAttribute, next_attribute: Option<&NodeAttribute>, )

Source§

impl Formatter<'_>

Source

pub fn element(&mut self, element: &NodeElement)

Source

pub fn children(&mut self, children: &[Node], attribute_count: usize)

Source§

impl Formatter<'_>

Source

pub fn string(&mut self, string: &str, start_column: usize)

Source

pub fn source_code<T: Spanned>(&mut self, span: &T)

Source

pub fn literal_str(&mut self, lit_str: &LitStr)

Source

pub fn node_value_block_expr( &mut self, block: &Block, unwrap_single_expr_blocks: bool, unwrap_single_lit_blocks: bool, )

Source

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

Source

pub fn fragment(&mut self, fragment: &NodeFragment)

Source§

impl Formatter<'_>

Source

pub fn view_macro(&mut self, view_mac: &ViewMacro<'_>)

Source§

impl Formatter<'_>

Source

pub fn node(&mut self, node: &Node)

Source

pub fn comment(&mut self, comment: &NodeComment)

Source

pub fn doctype(&mut self, doctype: &NodeDoctype)

Source

pub fn node_text(&mut self, text: &NodeText)

Source

pub fn raw_text(&mut self, raw_text: &RawText, use_source_text: bool)

Source

pub fn node_name(&mut self, name: &NodeName)

Source

pub fn node_block(&mut self, block: &NodeBlock)

Source§

impl Formatter<'_>

Source

pub fn tailwind_expr(&mut self, attr_value: String)

Source§

impl<'a> Formatter<'a>

Source

pub fn new(settings: &'a FormatterSettings, printer: &'a mut Printer) -> Self

Source

pub fn with_source( settings: &'a FormatterSettings, printer: &'a mut Printer, source: &'a Rope, comments: HashMap<usize, Option<String>>, ) -> Self

Source

pub fn trim_whitespace(&mut self, line_index: usize)

Source

pub fn flush_comments( &mut self, line_index: usize, skip_trailing_whitespace: bool, )

Source

pub fn format_syn_pat(&mut self, pat: &Pat)

Source

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> 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.