Skip to main content

CodegenBackend

Trait CodegenBackend 

Source
pub trait CodegenBackend {
    // Required methods
    fn lang(&self) -> &'static str;
    fn emit_css(&self, css: &Css) -> String;
    fn emit_project(&self, css: &Css) -> Vec<GeneratedFile>;
}
Expand description

Pluggable code-generation strategy. Each backend turns a parsed Css into a list of files that, taken together, form a buildable standalone project.

Required Methods§

Source

fn lang(&self) -> &'static str

Stable identifier (e.g. "rust") used by the HTTP layer to pick a backend.

Source

fn emit_css(&self, css: &Css) -> String

Render a single CSS expression. Useful for tests / quick previews where the caller doesn’t want a full project layout.

Source

fn emit_project(&self, css: &Css) -> Vec<GeneratedFile>

Emit a complete standalone project. The returned files are root-relative.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§