Skip to main content

GridSource

Trait GridSource 

Source
pub trait GridSource {
    // Required methods
    fn rows(&self) -> usize;
    fn cell(&self, row: usize, column: usize, text: &mut CellText) -> CellStyle;
}
Expand description

The data a GridPainter draws: one call per visible cell, every frame.

Implementations format straight into text (see densa_fmt) so a frame allocates nothing.

Required Methods§

Source

fn rows(&self) -> usize

Rows available; the painter draws at most as many as its layout holds.

Source

fn cell(&self, row: usize, column: usize, text: &mut CellText) -> CellStyle

Writes the text of the cell at row, column into text (empty on entry) and returns its style.

Text over CELL_BYTES does not fit: write a placeholder instead (for example a run of #, which the painter shows as overflow) rather than ignoring the error.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§