Skip to main content

Renderer

Trait Renderer 

Source
pub trait Renderer {
    type Output;

    // Required method
    fn render(
        &self,
        symbol: &Symbol,
        options: &RenderOptions,
    ) -> Result<Self::Output>;
}
Expand description

Draws a Symbol into some output representation.

Implementations must honour the shared Layout so that all output formats stay geometrically identical.

Required Associated Types§

Source

type Output

What this renderer produces — Vec<u8> for PNG, String for SVG.

Required Methods§

Source

fn render( &self, symbol: &Symbol, options: &RenderOptions, ) -> Result<Self::Output>

Render symbol.

§Errors

Returns Error::InvalidRenderOptions if the geometry is unusable, or Error::Render if the underlying encoder fails.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl Renderer for Png

Available on crate feature png only.
Source§

impl Renderer for Svg

Available on crate feature svg only.