pub struct TokenStream<T: Token>(/* private fields */);Expand description
Implementations§
source§impl TokenStream<PreToken>
impl TokenStream<PreToken>
sourcepub fn blank_line(&mut self)
pub fn blank_line(&mut self)
Inserts a blank line token to the stream if the stream does not already
end with a blank line. This will replace any Trivia::BlankLine
tokens with PreToken::BlankLine.
sourcepub fn end_line(&mut self)
pub fn end_line(&mut self)
Inserts an end of line token to the stream if the stream does not already end with an end of line token.
This will also trim any trailing PreToken::WordEnd tokens.
sourcepub fn end_word(&mut self)
pub fn end_word(&mut self)
Inserts a word end token to the stream if the stream does not already end with a word end token.
sourcepub fn increment_indent(&mut self)
pub fn increment_indent(&mut self)
Inserts an indent start token to the stream. This will also end the current line.
sourcepub fn decrement_indent(&mut self)
pub fn decrement_indent(&mut self)
Inserts an indent end token to the stream. This will also end the current line.
sourcepub fn blank_lines_allowed(&mut self)
pub fn blank_lines_allowed(&mut self)
Inserts a blank lines allowed context change.
sourcepub fn blank_lines_allowed_between_comments(&mut self)
pub fn blank_lines_allowed_between_comments(&mut self)
Inserts a blank lines allowed between comments context change.
sourcepub fn push_ast_token(&mut self, token: &Token)
pub fn push_ast_token(&mut self, token: &Token)
Pushes an AST token into the stream.
This will also push any preceding or inline trivia into the stream. Any token may have preceding or inline trivia, unless that token is itself trivia (i.e. trivia cannot have trivia).
sourcepub fn push_literal_in_place_of_token(
&mut self,
token: &Token,
replacement: String,
)
pub fn push_literal_in_place_of_token( &mut self, token: &Token, replacement: String, )
Pushes a literal string into the stream in place of an AST token. This will insert any trivia that would have been inserted with the AST token.
sourcepub fn push_literal(&mut self, value: String, kind: SyntaxKind)
pub fn push_literal(&mut self, value: String, kind: SyntaxKind)
Pushes a literal string into the stream. This will not insert any trivia.
sourcepub fn last_literal_kind(&self) -> Option<SyntaxKind>
pub fn last_literal_kind(&self) -> Option<SyntaxKind>
Returns the kind of the last literal token in the stream.
source§impl<T: Token> TokenStream<T>
impl<T: Token> TokenStream<T>
Trait Implementations§
source§impl<T: Token> Default for TokenStream<T>
impl<T: Token> Default for TokenStream<T>
source§impl<T: Token> IntoIterator for TokenStream<T>
impl<T: Token> IntoIterator for TokenStream<T>
Auto Trait Implementations§
impl<T> Freeze for TokenStream<T>
impl<T> RefUnwindSafe for TokenStream<T>where
T: RefUnwindSafe,
impl<T> Send for TokenStream<T>where
T: Send,
impl<T> Sync for TokenStream<T>where
T: Sync,
impl<T> Unpin for TokenStream<T>where
T: Unpin,
impl<T> UnwindSafe for TokenStream<T>where
T: UnwindSafe,
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more