Lines Matching defs:width
11 //! Determine displayed width of `char` and `str` types according to
22 //! let width = UnicodeWidthStr::width(teststr);
24 //! println!("The above string is {} columns wide.", width);
25 //! let width = teststr.width_cjk();
26 //! println!("The above string is {} columns wide (CJK).", width);
32 //! unicode-width supports a `no_std` feature. This eliminates dependence
42 //! unicode-width = "0.1.5"
69 /// Methods for determining displayed width of Unicode characters.
71 /// Returns the character's displayed width in columns, or `None` if the
78 fn width(self) -> Option<usize>;
80 /// Returns the character's displayed width in columns, or `None` if the
92 fn width(self) -> Option<usize> { cw::width(self, false) }
95 fn width_cjk(self) -> Option<usize> { cw::width(self, true) }
98 /// Methods for determining displayed width of Unicode strings.
100 /// Returns the string's displayed width in columns.
102 /// Control characters are treated as having zero width.
108 fn width<'a>(&'a self) -> usize;
110 /// Returns the string's displayed width in columns.
112 /// Control characters are treated as having zero width.
123 fn width(&self) -> usize {
124 self.chars().map(|c| cw::width(c, false).unwrap_or(0)).fold(0, Add::add)
129 self.chars().map(|c| cw::width(c, true).unwrap_or(0)).fold(0, Add::add)