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.
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
[+]
[+]
TokenStream::default()
returns an empty stream,
i.e. this is equivalent with TokenStream::new()
.
[+]
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
[+]
[+]
[+]
[−]
Extends a collection with the contents of an iterator. Read more
[+]
[−]
Extends a collection with the contents of an iterator. Read more
[+]
Collects a number of token trees into a single stream.
[+]
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.
[+]
Prints token in a form convenient for debugging.
[+]
[+]
[+]
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
)
[+]
[+]
[+]
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
)
[+]
[−]
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
[+]
[−]
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Create an error for a missing method specialization. Defaults to panicking with type, trait & method names. S
is the encoder/decoder state type, T
is the type being encoded/decoded, and the arguments are the names of the trait and method that should've been overridden. Read more