pub struct CapturedTokenTree { /* private fields */ }Expand description
One captured token: what it carries, where it sits, and how to reach the compiler span it came from.
Implementations§
Source§impl CapturedTokenTree
impl CapturedTokenTree
Sourcepub fn group_fragment(
&self,
expected: CapturedDelimiter,
) -> Option<CapturedFragment<'_>>
pub fn group_fragment( &self, expected: CapturedDelimiter, ) -> Option<CapturedFragment<'_>>
Borrow this token’s grouped members as one exact fragment when its delimiter matches.
Source§impl CapturedTokenTree
impl CapturedTokenTree
Sourcepub const fn payload(&self) -> &CapturedPayload
pub const fn payload(&self) -> &CapturedPayload
What this token carries.
Sourcepub const fn path(&self) -> &TokenPath
pub const fn path(&self) -> &TokenPath
The route from the root of the declared input to this token.
Sourcepub const fn span(&self) -> SpanHandle
pub const fn span(&self) -> SpanHandle
The handle into the producer’s span table.
Sourcepub const fn punct(&self) -> Option<char>
pub const fn punct(&self) -> Option<char>
The punctuation character this token spells, whether it stands alone or joins what follows.
Sourcepub fn raw_identifier(&self) -> Option<&str>
pub fn raw_identifier(&self) -> Option<&str>
The raw identifier’s name without its r# marker, where this is one.
Sourcepub const fn joint_punct(&self) -> Option<char>
pub const fn joint_punct(&self) -> Option<char>
The punctuation character joined to what follows, where this is one.
Sourcepub fn text(&self) -> Option<&str>
pub fn text(&self) -> Option<&str>
The text this token carries, where it is a text literal.
The text and never the spelling, so a raw text answers here on the same terms as a quoted one and the escape a quoted one carried is already read.
§Nonclaims
A byte string, a C string, a character, and a byte are not text and do not answer here; each is a different value at the seat it is written to, and a road wanting one asks for it by name.
Sourcepub fn number(&self) -> Option<&str>
pub fn number(&self) -> Option<&str>
The numeric spelling this token carries, where it is a numeric literal.
The spelling exactly as written — the base, the digit separators, and the suffix are part of what the declaration says — so a grammar wanting a value states which spellings it reads and refuses the rest itself.
Sourcepub fn group(&self) -> Option<(CapturedDelimiter, &[Self])>
pub fn group(&self) -> Option<(CapturedDelimiter, &[Self])>
The group this token opens, where it is one.
Trait Implementations§
Source§impl Clone for CapturedTokenTree
impl Clone for CapturedTokenTree
Source§fn clone(&self) -> CapturedTokenTree
fn clone(&self) -> CapturedTokenTree
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more