Struct syntax::tokenstream::TokenStream [−][src]
pub struct TokenStream {
kind: TokenStreamKind,
}🔬 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?
Token Streams
A TokenStream is an abstract sequence of tokens, organized into TokenTrees.
The goal is for procedural macros to work with TokenStreams and TokenTrees
instead of a representation of the abstract syntax tree.
Today's TokenTrees can still contain AST via Token::Interpolated for back-compat.
Fields
kind: TokenStreamKind
🔬 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?
Methods
impl TokenStream[src]
impl TokenStreampub fn len(&self) -> usize[src]
pub fn len(&self) -> usize🔬 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?
pub fn empty() -> TokenStream[src]
pub fn empty() -> TokenStream🔬 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?
pub fn is_empty(&self) -> bool[src]
pub fn is_empty(&self) -> bool🔬 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?
pub fn concat(streams: Vec<TokenStream>) -> TokenStream[src]
pub fn concat(streams: Vec<TokenStream>) -> TokenStream🔬 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?
fn concat_rc_slice(streams: RcSlice<TokenStream>) -> TokenStream[src]
fn concat_rc_slice(streams: RcSlice<TokenStream>) -> TokenStream🔬 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?
ⓘImportant traits for Cursorpub fn trees(&self) -> Cursor[src]
pub fn trees(&self) -> Cursor🔬 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?
ⓘImportant traits for Cursorpub fn into_trees(self) -> Cursor[src]
pub fn into_trees(self) -> Cursor🔬 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?
pub fn eq_unspanned(&self, other: &TokenStream) -> bool[src]
pub fn eq_unspanned(&self, other: &TokenStream) -> bool🔬 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?
Compares two TokenStreams, checking equality without regarding span information.
pub fn probably_equal_for_proc_macro(&self, other: &TokenStream) -> bool[src]
pub fn probably_equal_for_proc_macro(&self, other: &TokenStream) -> bool🔬 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?
pub fn as_tree(self) -> (TokenTree, bool)[src]
pub fn as_tree(self) -> (TokenTree, bool)🔬 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?
Precondition: self consists of a single token tree.
Returns true if the token tree is a joint operation w.r.t. proc_macro::TokenNode.
pub fn map_enumerated<F: FnMut(usize, TokenTree) -> TokenTree>(
self,
f: F
) -> TokenStream[src]
pub fn map_enumerated<F: FnMut(usize, TokenTree) -> TokenTree>(
self,
f: F
) -> TokenStream🔬 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?
pub fn map<F: FnMut(TokenTree) -> TokenTree>(self, f: F) -> TokenStream[src]
pub fn map<F: FnMut(TokenTree) -> TokenTree>(self, f: F) -> TokenStream🔬 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?
fn first_tree_and_joint(&self) -> Option<(TokenTree, bool)>[src]
fn first_tree_and_joint(&self) -> Option<(TokenTree, bool)>🔬 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?
fn last_tree_if_joint(&self) -> Option<TokenTree>[src]
fn last_tree_if_joint(&self) -> Option<TokenTree>🔬 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?
Trait Implementations
impl Clone for TokenStream[src]
impl Clone for TokenStreamfn clone(&self) -> TokenStream[src]
fn clone(&self) -> TokenStreamReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Debug for TokenStream[src]
impl Debug for TokenStreamfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl From<TokenTree> for TokenStream[src]
impl From<TokenTree> for TokenStreamfn from(tt: TokenTree) -> TokenStream[src]
fn from(tt: TokenTree) -> TokenStreamPerforms the conversion.
impl From<Token> for TokenStream[src]
impl From<Token> for TokenStreamfn from(token: Token) -> TokenStream[src]
fn from(token: Token) -> TokenStreamPerforms the conversion.
impl<T: Into<TokenStream>> FromIterator<T> for TokenStream[src]
impl<T: Into<TokenStream>> FromIterator<T> for TokenStreamfn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self[src]
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> SelfCreates a value from an iterator. Read more
impl Eq for TokenStream[src]
impl Eq for TokenStreamfn assert_receiver_is_total_eq(&self)1.0.0[src]
fn assert_receiver_is_total_eq(&self)impl PartialEq<TokenStream> for TokenStream[src]
impl PartialEq<TokenStream> for TokenStreamfn eq(&self, other: &TokenStream) -> bool[src]
fn eq(&self, other: &TokenStream) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
fn ne(&self, other: &Rhs) -> boolThis method tests for !=.
impl From<TokenStream> for ThinTokenStream[src]
impl From<TokenStream> for ThinTokenStreamfn from(stream: TokenStream) -> ThinTokenStream[src]
fn from(stream: TokenStream) -> ThinTokenStreamPerforms the conversion.
impl From<ThinTokenStream> for TokenStream[src]
impl From<ThinTokenStream> for TokenStreamfn from(stream: ThinTokenStream) -> TokenStream[src]
fn from(stream: ThinTokenStream) -> TokenStreamPerforms the conversion.
impl Display for TokenStream[src]
impl Display for TokenStreamfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Encodable for TokenStream[src]
impl Encodable for TokenStreamfn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), E::Error>[src]
fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), E::Error>🔬 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?
impl Decodable for TokenStream[src]
impl Decodable for TokenStreamfn decode<D: Decoder>(decoder: &mut D) -> Result<TokenStream, D::Error>[src]
fn decode<D: Decoder>(decoder: &mut D) -> Result<TokenStream, D::Error>🔬 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?
impl Hash for TokenStream[src]
impl Hash for TokenStreamAuto Trait Implementations
impl !Send for TokenStream
impl !Send for TokenStreamimpl !Sync for TokenStream
impl !Sync for TokenStream