pub struct StrGraphQLTokenSourceConfig {
pub retain_comments: bool,
pub retain_commas: bool,
pub retain_whitespace: bool,
}Expand description
Configuration for StrGraphQLTokenSource
controlling which trivia types are captured during lexing.
All flags default to true, meaning the lexer operates in full-fidelity
mode by default — every comment, comma, and whitespace run is preserved
as trivia on the emitted tokens. Set individual flags to false to
discard specific trivia types for leaner output.
§Example
use libgraphql_parser::token::StrGraphQLTokenSourceConfig;
// Full-fidelity (default): all trivia preserved
let full = StrGraphQLTokenSourceConfig::default();
assert!(full.retain_comments);
assert!(full.retain_commas);
assert!(full.retain_whitespace);
// Lean mode: discard all trivia
let lean = StrGraphQLTokenSourceConfig::no_trivia();
assert!(!lean.retain_comments);
assert!(!lean.retain_commas);
assert!(!lean.retain_whitespace);Fields§
§retain_comments: boolWhether to preserve # comments as
GraphQLTriviaToken::Comment
on emitted tokens.
When false, comments are still consumed (skipped) by the lexer but
not recorded as trivia.
retain_commas: boolWhether to preserve commas as
GraphQLTriviaToken::Comma
on emitted tokens.
When false, commas are still consumed (skipped) by the lexer but
not recorded as trivia.
retain_whitespace: boolWhether to preserve whitespace runs as
GraphQLTriviaToken::Whitespace
on emitted tokens.
When false, whitespace is still consumed (skipped) by the lexer but
not recorded as trivia. This is the most impactful flag for
performance since whitespace runs are frequent.
Implementations§
Trait Implementations§
Source§impl Clone for StrGraphQLTokenSourceConfig
impl Clone for StrGraphQLTokenSourceConfig
Source§fn clone(&self) -> StrGraphQLTokenSourceConfig
fn clone(&self) -> StrGraphQLTokenSourceConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more