pub fn codepoint_width(codepoint: char) -> u8Expand description
Returns the terminal display width of a Unicode codepoint in terminal grid cells.
This is the same width table the terminal itself uses when laying out printed text, so callers can predict column layout that exactly matches what the terminal will do when the text is actually written to it.
Returns 0 for zero-width characters, 2 for wide characters, and 1 for
everything else. This operates on a single character only and therefore
cannot account for grapheme-cluster-level width rules. For cluster-accurate
widths, use grapheme_width. Summing per-character widths is only correct
when mode 2027, grapheme clustering, is disabled.
This function is pure, allocates nothing, and is thread-safe.