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§
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)
Available on crate feature
custom_sourcemap only.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 Methods§
fn error( &self, kind: PrinterErrorKind, loc: Location, ) -> Error<PrinterErrorKind>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".