Struct quote::Tokens [−][src]
pub struct Tokens { /* fields omitted */ }Tokens produced by a quote! invocation.
Methods
impl Tokens[src]
impl Tokenspub fn new() -> Self[src]
pub fn new() -> SelfEmpty tokens.
pub fn append<U>(&mut self, token: U) where
U: Into<TokenTree>, [src]
pub fn append<U>(&mut self, token: U) where
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]
pub fn append_all<T, I>(&mut self, iter: I) where
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]
pub fn append_separated<T, I, U>(&mut self, iter: I, op: U) where
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]
pub fn append_terminated<T, I, U>(&mut self, iter: I, term: U) where
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]
impl Clone for Tokensfn clone(&self) -> Tokens[src]
fn clone(&self) -> TokensReturns 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 Default for Tokens[src]
impl Default for Tokensimpl ToTokens for Tokens[src]
impl ToTokens for Tokensfn to_tokens(&self, dst: &mut Tokens)[src]
fn to_tokens(&self, dst: &mut Tokens)Write self to the given Tokens. Read more
fn into_tokens(self) -> Tokens[src]
fn into_tokens(self) -> TokensConvert self directly into a Tokens object. Read more
impl From<Tokens> for TokenStream[src]
impl From<Tokens> for TokenStreamfn from(tokens: Tokens) -> TokenStream[src]
fn from(tokens: Tokens) -> TokenStreamPerforms the conversion.
impl From<Tokens> for TokenStream[src]
impl From<Tokens> for TokenStreamfn from(tokens: Tokens) -> TokenStream[src]
fn from(tokens: Tokens) -> TokenStreamPerforms the conversion.
impl IntoIterator for Tokens[src]
impl IntoIterator for TokensAllows 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]
fn into_iter(self) -> Self::IntoIterCreates an iterator from a value. Read more
impl Display for Tokens[src]
impl Display for Tokensfn fmt(&self, formatter: &mut Formatter) -> Result[src]
fn fmt(&self, formatter: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Debug for Tokens[src]
impl Debug for Tokensfn fmt(&self, formatter: &mut Formatter) -> Result[src]
fn fmt(&self, formatter: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl PartialEq for Tokens[src]
impl PartialEq for Tokensfn eq(&self, other: &Self) -> bool[src]
fn eq(&self, other: &Self) -> 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<'a> Hash for Tokens[src]
impl<'a> Hash for Tokens