pub struct TriviaSink { /* private fields */ }Expand description
A sink that collects trivia as the lexer advances.
Use TriviaSink::new to create a collecting sink, or
TriviaSink::disabled to create a discarding sink.
Implementations§
Source§impl TriviaSink
impl TriviaSink
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Is this sink collecting trivia?
Sourcepub fn record(&mut self, trivia: Trivia)
pub fn record(&mut self, trivia: Trivia)
Record a trivia element. If the sink is disabled, this is a no-op.
Sourcepub fn record_line_comment(&mut self, text: &str, span: Span)
pub fn record_line_comment(&mut self, text: &str, span: Span)
Record a line comment.
Sourcepub fn record_block_comment(&mut self, text: &str, span: Span)
pub fn record_block_comment(&mut self, text: &str, span: Span)
Record a block comment.
Sourcepub fn record_whitespace(&mut self, text: &str, span: Span)
pub fn record_whitespace(&mut self, text: &str, span: Span)
Record whitespace.
Sourcepub fn whitespace(&self) -> Vec<&Trivia>
pub fn whitespace(&self) -> Vec<&Trivia>
Get only the whitespace trivia.
Trait Implementations§
Source§impl Clone for TriviaSink
impl Clone for TriviaSink
Source§impl Debug for TriviaSink
impl Debug for TriviaSink
Auto Trait Implementations§
impl Freeze for TriviaSink
impl RefUnwindSafe for TriviaSink
impl Send for TriviaSink
impl Sync for TriviaSink
impl Unpin for TriviaSink
impl UnsafeUnpin for TriviaSink
impl UnwindSafe for TriviaSink
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