Skip to main content

cluster_width

Function cluster_width 

Source
pub fn cluster_width(cluster: &str) -> u16
Expand description

The width in cells of cluster, taken as one extended grapheme cluster.

East Asian ambiguous characters count 1 cell. A ZWJ emoji sequence counts as one emoji, 2 cells, not the sum of its parts. A width over u16::MAX saturates.