1 2 3 4 5 6 7 8 9
#[cfg(feature = "unicode")] use unicode_width::UnicodeWidthStr; pub fn get_string_width(s: &str) -> usize { #[cfg(feature = "unicode")] return UnicodeWidthStr::width(s); #[cfg(not(feature = "unicode"))] s.len() }