pub struct Grapheme<'a, E: Encoding> {
pub units: &'a [E::Unit],
pub width: usize,
}Expand description
A borrowed extended grapheme cluster and its terminal cell width.
Fields§
§units: &'a [E::Unit]Code units belonging to this cluster.
width: usizeTerminal cells occupied by this cluster.
Implementations§
Source§impl<E: Encoding> Grapheme<'_, E>
impl<E: Encoding> Grapheme<'_, E>
Sourcepub fn is_control(&self) -> bool
pub fn is_control(&self) -> bool
Returns whether the cluster’s base codepoint is a C0, DEL, or C1
control (Cc).
CRLF is one cluster and reports true. Controls always have width zero,
but the converse does not hold: zero-width formats such as ZWSP and ZWJ,
and combining marks, report false. Terminal renderers can use this
distinction to decide whether to skip a cluster or draw it. An empty
manually constructed cluster reports false.
Trait Implementations§
Auto Trait Implementations§
impl<'a, E> Freeze for Grapheme<'a, E>
impl<'a, E> RefUnwindSafe for Grapheme<'a, E>
impl<'a, E> Send for Grapheme<'a, E>
impl<'a, E> Sync for Grapheme<'a, E>
impl<'a, E> Unpin for Grapheme<'a, E>
impl<'a, E> UnsafeUnpin for Grapheme<'a, E>
impl<'a, E> UnwindSafe for Grapheme<'a, E>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more