[−][src]Struct syntax::tokenstream::TokenStream
⚙️ This is an internal compiler API. (rustc_private)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.
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.
The use of Option is an optimization that avoids the need for an
allocation when the stream is empty. However, it is not guaranteed that an
empty stream is represented with None; it may be represented as a Some
around an empty Vec.
Methods
impl TokenStream[src]
pub(crate) fn add_comma(&self) -> Option<(TokenStream, Span)>[src]
⚙️ This is an internal compiler API. (rustc_private)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.
Given a TokenStream with a Stream of only two arguments, return a new TokenStream
separating the two arguments with a comma for diagnostic suggestions.
impl TokenStream[src]
pub fn len(&self) -> usize[src]
⚙️ This is an internal compiler API. (rustc_private)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.
pub fn empty() -> TokenStream[src]
⚙️ This is an internal compiler API. (rustc_private)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.
pub fn is_empty(&self) -> bool[src]
⚙️ This is an internal compiler API. (rustc_private)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.
pub(crate) fn from_streams(streams: SmallVec<[TokenStream; 2]>) -> TokenStream[src]
⚙️ This is an internal compiler API. (rustc_private)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.
pub fn new(streams: Vec<TreeAndJoint>) -> TokenStream[src]
⚙️ This is an internal compiler API. (rustc_private)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.
pub fn append_to_tree_and_joint_vec(self, vec: &mut Vec<TreeAndJoint>)[src]
⚙️ This is an internal compiler API. (rustc_private)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.
ⓘImportant traits for Cursorpub fn trees(&self) -> Cursor[src]
⚙️ This is an internal compiler API. (rustc_private)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.
ⓘImportant traits for Cursorpub fn into_trees(self) -> Cursor[src]
⚙️ This is an internal compiler API. (rustc_private)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.
pub fn eq_unspanned(&self, other: &TokenStream) -> bool[src]
⚙️ This is an internal compiler API. (rustc_private)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.
Compares two TokenStreams, checking equality without regarding span information.
pub fn probably_equal_for_proc_macro(&self, other: &TokenStream) -> bool[src]
⚙️ This is an internal compiler API. (rustc_private)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.
pub fn map_enumerated<F: FnMut(usize, TokenTree) -> TokenTree>(
self,
f: F
) -> TokenStream[src]
self,
f: F
) -> TokenStream
⚙️ This is an internal compiler API. (rustc_private)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.
pub fn map<F: FnMut(TokenTree) -> TokenTree>(self, f: F) -> TokenStream[src]
⚙️ This is an internal compiler API. (rustc_private)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.
fn first_tree_and_joint(&self) -> Option<TreeAndJoint>[src]
⚙️ This is an internal compiler API. (rustc_private)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.
fn last_tree_if_joint(&self) -> Option<TokenTree>[src]
⚙️ This is an internal compiler API. (rustc_private)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.
Trait Implementations
impl Clone for TokenStream[src]
fn clone(&self) -> TokenStream[src]
default fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Eq for TokenStream[src]
default fn assert_receiver_is_total_eq(&self)1.0.0[src]
impl PartialEq<TokenStream> for TokenStream[src]
fn eq(&self, other: &TokenStream) -> bool[src]
#[must_use]
default fn ne(&self, other: &Rhs) -> bool1.0.0[src]
This method tests for !=.
impl From<TokenTree> for TokenStream[src]
fn from(tree: TokenTree) -> TokenStream[src]
impl From<Token> for TokenStream[src]
fn from(token: Token) -> TokenStream[src]
impl Display for TokenStream[src]
impl Debug for TokenStream[src]
impl<T: Into<TokenStream>> FromIterator<T> for TokenStream[src]
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self[src]
impl Encodable for TokenStream[src]
impl Decodable for TokenStream[src]
Auto Trait Implementations
impl !Send for TokenStream
impl !Sync for TokenStream
Blanket Implementations
impl<T, U> Into for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
impl<T> From for T[src]
impl<T, U> TryFrom for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T> Borrow for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Encodable for T where
T: UseSpecializedEncodable + ?Sized, [src]
T: UseSpecializedEncodable + ?Sized,
impl<T> Decodable for T where
T: UseSpecializedDecodable, [src]
T: UseSpecializedDecodable,
impl<E> SpecializationError for E[src]
default fn not_found<S, T>(
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized, [src]
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
impl<T> Send for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Sync for T where
T: ?Sized, [src]
T: ?Sized,