pub struct TokenRef<'a> {
pub text: &'a str,
pub start: usize,
pub end: usize,
}Expand description
A borrowed token with character offsets into the source text.
start and end are character offsets (Unicode scalar values), not byte
offsets. To recover the substring from the original text, use
text.chars().skip(start).take(end - start).collect::<String>().
Fields§
§text: &'a strThe token text (borrowed slice).
start: usizeCharacter offset where the token starts (inclusive).
end: usizeCharacter offset where the token ends (exclusive).
Trait Implementations§
impl<'a> Copy for TokenRef<'a>
impl<'a> Eq for TokenRef<'a>
impl<'a> StructuralPartialEq for TokenRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for TokenRef<'a>
impl<'a> RefUnwindSafe for TokenRef<'a>
impl<'a> Send for TokenRef<'a>
impl<'a> Sync for TokenRef<'a>
impl<'a> Unpin for TokenRef<'a>
impl<'a> UnsafeUnpin for TokenRef<'a>
impl<'a> UnwindSafe for TokenRef<'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