pub trait ToCss {
// Required method
fn to_css(&self, dest: &mut dyn Write) -> Result;
// Provided method
fn to_css_string(&self) -> String { ... }
}Expand description
Format a value as the CSS source text Lynx will parse.
Implementors must write a string that, when fed back into Lynx’s CSS parser for the property accepting the value, produces an equivalent computed value. Whitespace, casing, and unit choice follow the canonical CSS form documented at https://lynxjs.org/api/css.
A blanket fmt::Display is not provided automatically so
implementors stay explicit about which surface (CSS-text vs.
debug) they’re writing.
Required Methods§
Provided Methods§
Sourcefn to_css_string(&self) -> String
fn to_css_string(&self) -> String
Convenience: allocate a fresh String and write into it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".