Skip to main content

Renderer

Trait Renderer 

Source
pub trait Renderer<E> {
    type Frame;

    // Required method
    fn render(&self, env: &E) -> Self::Frame;
}
Expand description

A renderer for environment E.

The associated Frame type makes rendering zero-cost when NullRenderer is used — Frame = () means no allocation occurs and the call optimises away.

ASCII text renderers pick Frame = String; image renderers pick Frame = Vec<u8> or Frame = image::RgbImage.

Required Associated Types§

Source

type Frame

The output produced by one render call.

Required Methods§

Source

fn render(&self, env: &E) -> Self::Frame

Render the current state of env and return a frame.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§