Guide API
Skip to main content

draw_one

Function draw_one 

Source
pub fn draw_one(
    cells: &mut [Cell],
    i: usize,
    text: &str,
    j: usize,
    transform: impl FnMut(&mut Style),
) -> (usize, usize)
Expand description

Write a single grapheme from text (at byte offset j) into cells at index i, applying transform to the Style of each cell written. Returns (bytes_consumed, cells_advanced).

A wide glyph applies transform to both its lead and trailing cell. cells_advanced == 0 with bytes_consumed == 0 means there was no room — the caller should stop.