Struct quote::Tokens
[−]
[src]
pub struct Tokens { /* fields omitted */ }
Tokens produced by a quote!
invocation.
Methods
impl Tokens
[src]
pub fn new() -> Self
[src]
Empty tokens.
pub fn append<U>(&mut self, token: U) where
U: Into<TokenTree>,
[src]
U: Into<TokenTree>,
For use by ToTokens
implementations.
Appends the token specified to this list of tokens.
pub fn append_all<T, I>(&mut self, iter: I) where
T: ToTokens,
I: IntoIterator<Item = T>,
[src]
T: ToTokens,
I: IntoIterator<Item = T>,
For use by ToTokens
implementations.
struct X; impl ToTokens for X { fn to_tokens(&self, tokens: &mut Tokens) { tokens.append_all(&[true, false]); } } let tokens = quote!(#X); assert_eq!(tokens.to_string(), "true false");
pub fn append_separated<T, I, U>(&mut self, iter: I, op: U) where
T: ToTokens,
I: IntoIterator<Item = T>,
U: ToTokens,
[src]
T: ToTokens,
I: IntoIterator<Item = T>,
U: ToTokens,
For use by ToTokens
implementations.
Appends all of the items in the iterator I
, separated by the tokens
U
.
pub fn append_terminated<T, I, U>(&mut self, iter: I, term: U) where
T: ToTokens,
I: IntoIterator<Item = T>,
U: ToTokens,
[src]
T: ToTokens,
I: IntoIterator<Item = T>,
U: ToTokens,
For use by ToTokens
implementations.
Appends all tokens in the iterator I
, appending U
after each
element, including after the last element of the iterator.
Trait Implementations
impl Clone for Tokens
[src]
fn clone(&self) -> Tokens
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Default for Tokens
[src]
impl ToTokens for Tokens
[src]
fn to_tokens(&self, dst: &mut Tokens)
[src]
Write self
to the given Tokens
. Read more
fn into_tokens(self) -> Tokens
[src]
Convert self
directly into a Tokens
object. Read more
impl From<Tokens> for TokenStream
[src]
fn from(tokens: Tokens) -> TokenStream
[src]
Performs the conversion.
impl From<Tokens> for TokenStream
[src]
fn from(tokens: Tokens) -> TokenStream
[src]
Performs the conversion.
impl IntoIterator for Tokens
[src]
Allows a Tokens
to be passed to Tokens::append_all
.
type Item = TokenTree
The type of the elements being iterated over.
type IntoIter = IntoIter
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
Creates an iterator from a value. Read more
impl Display for Tokens
[src]
fn fmt(&self, formatter: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Debug for Tokens
[src]
fn fmt(&self, formatter: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl PartialEq for Tokens
[src]
fn eq(&self, other: &Self) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.