pub struct Token<'a> {
pub kind: TokenKind,
pub raw: &'a str,
pub pos: usize,
pub name_kind: NameKind,
pub scalar_kind: ScalarKind,
pub has_separator: bool,
}Available on crate feature
text only.Expand description
A single textproto token, borrowing from the input.
Fields§
§kind: TokenKindWhat kind of token this is.
raw: &'a strThe raw input slice covered by this token. For strings, this includes
the quotes and any adjacent concatenated literals. For bracketed type
names, it includes the [ and ].
pos: usizeByte offset of raw into the original input. Use
Tokenizer::line_col to convert to 1-based line:col for errors.
name_kind: NameKindFor Name tokens: which kind of name. Ident for non-Name tokens.
scalar_kind: ScalarKindFor Scalar tokens: which kind of scalar. Number for non-Scalar.
has_separator: boolFor Name tokens: was this name followed by a : separator?
The : is optional before a message value or a list of message
values, and required before a scalar or a list of scalars.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Forget for Token<'a>
impl<'a> Freeze for Token<'a>
impl<'a> Move 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