Skip to main content

PrinterTrait

Trait PrinterTrait 

Source
pub trait PrinterTrait: Write + Sealed {
Show 14 methods // Required methods fn options(&self) -> &PrinterOptions<'_>; fn filename(&self) -> &str; fn whitespace(&mut self) -> Result<(), PrinterError>; fn delim(&mut self, c: char, ws_before: bool) -> Result<(), PrinterError>; fn newline(&mut self) -> Result<(), PrinterError>; fn add_mapping(&mut self, loc: Location); fn indent(&mut self); fn dedent(&mut self); fn indent_by(&mut self, amt: u8); fn dedent_by(&mut self, amt: u8); fn write_ident( &mut self, ident: &str, handle_css_module: bool, ) -> Result<(), PrinterError>; fn write_dashed_ident( &mut self, ident: &str, is_declaration: bool, ) -> Result<(), PrinterError>; fn without_css_module<T, E>( &mut self, f: impl FnOnce(&mut Self) -> Result<T, E>, ) -> Result<T, E>; // Provided method fn error( &self, kind: PrinterErrorKind, loc: Location, ) -> Error<PrinterErrorKind> { ... }
}
Expand description

A printer abstraction used by CSS serialization implementations.

Required Methods§

Source

fn options(&self) -> &PrinterOptions<'_>

Source

fn filename(&self) -> &str

Source

fn whitespace(&mut self) -> Result<(), PrinterError>

Source

fn delim(&mut self, c: char, ws_before: bool) -> Result<(), PrinterError>

Source

fn newline(&mut self) -> Result<(), PrinterError>

Source

fn add_mapping(&mut self, loc: Location)

Available on crate feature custom_sourcemap only.
Source

fn indent(&mut self)

Source

fn dedent(&mut self)

Source

fn indent_by(&mut self, amt: u8)

Source

fn dedent_by(&mut self, amt: u8)

Source

fn write_ident( &mut self, ident: &str, handle_css_module: bool, ) -> Result<(), PrinterError>

Source

fn write_dashed_ident( &mut self, ident: &str, is_declaration: bool, ) -> Result<(), PrinterError>

Source

fn without_css_module<T, E>( &mut self, f: impl FnOnce(&mut Self) -> Result<T, E>, ) -> Result<T, E>

Provided Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a, 'c, W: Write + Sized, S: SourceMap> PrinterTrait for Printer<'a, 'c, W, S>