Skip to main content

PrinterTrait

Trait PrinterTrait 

Source
pub trait PrinterTrait: Write + Sealed {
Show 17 methods // Required methods fn options(&self) -> &PrinterOptions<'_>; fn state(&self) -> &PrinterState<'_, '_>; fn state_mut(&mut self) -> &mut PrinterState<'_, '_>; 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 write_str_with_newlines(&mut self, s: &str) -> 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>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T; // 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 state(&self) -> &PrinterState<'_, '_>

Source

fn state_mut(&mut self) -> &mut PrinterState<'_, '_>

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 write_str_with_newlines(&mut self, s: &str) -> Result<(), PrinterError>

Source

fn add_mapping(&mut self, loc: Location)

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>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T

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>