pub enum Token<'a> {
Text {
text: &'a [u8],
width: u16,
},
Escape(&'a [u8]),
Control(u8),
}Expand description
A single token produced by tokenize.
Variants§
Text
One grapheme cluster and its display width.
Always whole, well-formed UTF-8. The width may be zero - a combining
mark, a variation selector, or a C1 character such as U+009C written
as C2 9C - so “visible” here means “not a control byte”, not
“occupies a cell”.
Escape(&'a [u8])
An ANSI escape sequence (passed through verbatim, no width).
Control(u8)
A single byte that stands on its own: a C0 control, DEL, a C1 byte that introduces nothing, or a byte that begins no well-formed UTF-8 character. All are zero width.
Trait Implementations§
impl<'a> Eq for Token<'a>
impl<'a> StructuralPartialEq for Token<'a>
Auto Trait Implementations§
impl<'a> Freeze for Token<'a>
impl<'a> RefUnwindSafe for Token<'a>
impl<'a> Send for Token<'a>
impl<'a> Sync for Token<'a>
impl<'a> Unpin for Token<'a>
impl<'a> UnsafeUnpin for Token<'a>
impl<'a> UnwindSafe for Token<'a>
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