Skip to main content

Exporter

Trait Exporter 

Source
pub trait Exporter: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn export(&self, output: &RenderOutput) -> Result<Vec<u8>>;
    fn extension(&self) -> &'static str;
    fn mime_type(&self) -> &'static str;
}
Expand description

The final step: pixels become files

Exporters know how to encode rendered output into the format users actually want - PNG, SVG, JSON, and more.

Required Methods§

Source

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

Who are you?

Source

fn export(&self, output: &RenderOutput) -> Result<Vec<u8>>

Encode the rendered output as bytes

Source

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

What file extension should be used?

Source

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

What MIME type identifies your format?

Implementors§