pub fn display_width(s: &str) -> usizeExpand description
Re-exports: Primary public API Returns the total display width (in columns) of a string, based on grapheme clusters.
This function segments the input string into Unicode grapheme clusters and sums
the display width of each one using display_width. The result reflects
how much horizontal space the entire string occupies in a monospace terminal,
accounting for wide characters such as CJK ideographs and emoji.
§Arguments
s- The input string to measure
§Returns
The total display width of the string in terminal columns.
§Example
use runefix_core::display_width;
let width = display_width("Hi,世界");
assert_eq!(width, 8); // 1 + 1 + 2 + 2 + 2