pub struct Token<'a> {
pub kind: TokenKind,
pub bytes: &'a [u8],
pub width: u16,
pub control: u8,
}Expand description
A single token produced by tokenize.
Fields§
§kind: TokenKindThe token category.
bytes: &'a [u8]The original input bytes, borrowed without modification.
Tokens returned by tokenize contain a nonempty slice.
Standalone UTF-8 C1 controls contain 0xC2 followed by the control code.
width: u16The display width in terminal cells.
Escape and control tokens have width zero. Text width depends on the selected width mode and can be zero for combining marks.
control: u8The decoded byte for a control token, or zero for text and escape tokens.
Raw and UTF-8 C1 encodings produce the same control code. A malformed byte retains its byte value here.
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