pub fn display_widths(s: &str) -> Vec<usize>Expand description
Re-exports: Primary public API Returns the display width (in columns) of each grapheme cluster in the input string.
This function segments the input string into Unicode grapheme clusters and computes the display width of each one individually. It is useful for scenarios like monospace text layout, visual alignment, or rendering terminals where East Asian characters and emoji take more than one column.
§Arguments
s- The input string to analyze
§Returns
A vector of display widths (usize) for each grapheme cluster in order.
§Example
use runefix_core::display_widths;
let widths = display_widths("Hi,世界");
assert_eq!(widths, vec![1, 1, 2, 2, 2]);