pub struct TokenStream { /* fields omitted */ }
An abstract stream of tokens, or more concretely a sequence of token trees.
This type provides interfaces for iterating over token trees and for
collecting token trees into one stream.
Token stream is both the input and output of #[proc_macro]
,
#[proc_macro_attribute]
and #[proc_macro_derive]
definitions.
Returns an empty TokenStream
containing no token trees.
Deprecated since 0.4.4
: please use TokenStream::new
Checks if this TokenStream
is empty.
TokenStream::default()
returns an empty stream,
i.e. this is equivalent with TokenStream::new()
.
Returns the "default value" for a type. Read more
Performs copy-assignment from source
. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Extends a collection with the contents of an iterator. Read more
Extends a collection with the contents of an iterator. Read more
Prints the token stream as a string that is supposed to be losslessly
convertible back into the same token stream (modulo spans), except for
possibly TokenTree::Group
s with Delimiter::None
delimiters and negative
numeric literals.
Formats the value using the given formatter. Read more
Collects a number of token trees into a single stream.
Prints token in a form convenient for debugging.
Formats the value using the given formatter. Read more
Attempts to break the string into tokens and parse those tokens into a token
stream.
May fail for a number of reasons, for example, if the string contains
unbalanced delimiters or characters not existing in the language.
NOTE: Some errors may cause panics instead of returning LexError
. We
reserve the right to change these errors into LexError
s later.
type Err = LexError
The associated error which can be returned from parsing.
Parses a string s
to return a value of this type. Read more
Converts the given value to a String
. Read more
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
type Owned = T
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
type Error = !
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Mutably borrows from an owned value. Read more
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)