pub enum GraphQLTriviaToken<'src> {
Comment {
value: Cow<'src, str>,
span: GraphQLSourceSpan,
},
Comma {
span: GraphQLSourceSpan,
},
}Expand description
A “trivia token” is a token that doesn’t affect parsing but is still preserved (e.g. for tooling use).
Trivia includes comments and commas, which are attached to the following token as “preceding trivia”. This allows formatters and linters to preserve these elements without the parser needing to handle them explicitly.
§Lifetime Parameter
The 'src lifetime enables zero-copy lexing for comment values:
StrGraphQLTokenSource can borrow comment text directly from the source.
Variants§
Comment
A GraphQL comment, which starts with # and extends to the end of the
line.
Fields
value: Cow<'src, str>The comment text (excluding the leading #).
Uses Cow<'src, str> to enable zero-copy lexing from string sources.
span: GraphQLSourceSpanThe source location of the comment.
Comma
A comma separator. In GraphQL, commas are optional and treated as whitespace, but we preserve them as trivia.
Fields
span: GraphQLSourceSpanThe source location of the comma.
Trait Implementations§
Source§impl<'src> Clone for GraphQLTriviaToken<'src>
impl<'src> Clone for GraphQLTriviaToken<'src>
Source§fn clone(&self) -> GraphQLTriviaToken<'src>
fn clone(&self) -> GraphQLTriviaToken<'src>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more