[−][src]Struct quote::Tokens
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 ToTokens for Tokens
[src]
impl Default for Tokens
[src]
impl Clone for Tokens
[src]
impl PartialEq<Tokens> for Tokens
[src]
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]
impl From<Tokens> for TokenStream
[src]
fn from(tokens: Tokens) -> TokenStream
[src]
impl From<Tokens> for TokenStream
[src]
fn from(tokens: Tokens) -> TokenStream
[src]
impl<'a> Hash for Tokens
[src]
fn hash<H: Hasher>(&self, h: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Debug for Tokens
[src]
impl Display for Tokens
[src]
Auto Trait Implementations
impl !Send for Tokens
impl Unpin for Tokens
impl !Sync for Tokens
impl UnwindSafe for Tokens
impl RefUnwindSafe for Tokens
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
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?
fn into_iter(self) -> I
[src]
impl<T> From<T> for T
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> 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, U> TryInto<U> 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> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,