Trait futures_await_quote::ToTokens [] [src]

pub trait ToTokens {
    fn to_tokens(&self, _: &mut Tokens);

    fn into_tokens(self) -> Tokens
    where
        Self: Sized
, { ... } }

Types that can be interpolated inside a quote!(...) invocation.

Required Methods

Write self to the given Tokens.

Example implementation for a struct representing Rust paths like std::cmp::PartialEq:

Be careful when using this code, it's not being tested!
pub struct Path {
    pub global: bool,
    pub segments: Vec<PathSegment>,
}

impl ToTokens for Path {
    fn to_tokens(&self, tokens: &mut Tokens) {
        for (i, segment) in self.segments.iter().enumerate() {
            if i > 0 || self.global {
                tokens.append("::");
            }
            segment.to_tokens(tokens);
        }
    }
}

Provided Methods

Convert self directly into a Tokens object.

This method is implicitly implemented using to_tokens, and acts as a convenience method for consumers of the ToTokens trait.

Implementations on Foreign Types

impl ToTokens for TokenStream
[src]

[src]

[src]

impl ToTokens for TokenTree
[src]

[src]

[src]

impl<'a, T: ?Sized + ToTokens> ToTokens for &'a T
[src]

[src]

[src]

impl<'a, T: ?Sized + ToOwned + ToTokens> ToTokens for Cow<'a, T>
[src]

[src]

[src]

impl<T: ?Sized + ToTokens> ToTokens for Box<T>
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for Option<T>
[src]

[src]

[src]

impl ToTokens for Term
[src]

[src]

[src]

impl ToTokens for str
[src]

[src]

[src]

impl ToTokens for String
[src]

[src]

[src]

impl ToTokens for i8
[src]

[src]

[src]

impl ToTokens for i16
[src]

[src]

[src]

impl ToTokens for i32
[src]

[src]

[src]

impl ToTokens for i64
[src]

[src]

[src]

impl ToTokens for isize
[src]

[src]

[src]

impl ToTokens for u8
[src]

[src]

[src]

impl ToTokens for u16
[src]

[src]

[src]

impl ToTokens for u32
[src]

[src]

[src]

impl ToTokens for u64
[src]

[src]

[src]

impl ToTokens for usize
[src]

[src]

[src]

impl ToTokens for f32
[src]

[src]

[src]

impl ToTokens for f64
[src]

[src]

[src]

impl ToTokens for char
[src]

[src]

[src]

impl ToTokens for bool
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for Vec<T>
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 0]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 1]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 2]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 3]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 4]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 5]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 6]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 7]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 8]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 9]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 10]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 11]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 12]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 13]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 14]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 15]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 16]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 17]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 18]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 19]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 20]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 21]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 22]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 23]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 24]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 25]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 26]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 27]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 28]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 29]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 30]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 31]
[src]

[src]

[src]

impl<T: ToTokens> ToTokens for [T; 32]
[src]

[src]

[src]

impl ToTokens for ()
[src]

[src]

[src]

impl<A: ToTokens> ToTokens for (A,)
[src]

[src]

[src]

impl<A: ToTokens, B: ToTokens> ToTokens for (A, B)
[src]

[src]

[src]

impl<A: ToTokens, B: ToTokens, C: ToTokens> ToTokens for (A, B, C)
[src]

[src]

[src]

impl<A: ToTokens, B: ToTokens, C: ToTokens, D: ToTokens> ToTokens for (A, B, C, D)
[src]

[src]

[src]

impl<A: ToTokens, B: ToTokens, C: ToTokens, D: ToTokens, E: ToTokens> ToTokens for (A, B, C, D, E)
[src]

[src]

[src]

impl<A: ToTokens, B: ToTokens, C: ToTokens, D: ToTokens, E: ToTokens, F: ToTokens> ToTokens for (A, B, C, D, E, F)
[src]

[src]

[src]

impl<A: ToTokens, B: ToTokens, C: ToTokens, D: ToTokens, E: ToTokens, F: ToTokens, G: ToTokens> ToTokens for (A, B, C, D, E, F, G)
[src]

[src]

[src]

impl<A: ToTokens, B: ToTokens, C: ToTokens, D: ToTokens, E: ToTokens, F: ToTokens, G: ToTokens, H: ToTokens> ToTokens for (A, B, C, D, E, F, G, H)
[src]

[src]

[src]

impl<A: ToTokens, B: ToTokens, C: ToTokens, D: ToTokens, E: ToTokens, F: ToTokens, G: ToTokens, H: ToTokens, I: ToTokens> ToTokens for (A, B, C, D, E, F, G, H, I)
[src]

[src]

[src]

impl<A: ToTokens, B: ToTokens, C: ToTokens, D: ToTokens, E: ToTokens, F: ToTokens, G: ToTokens, H: ToTokens, I: ToTokens, J: ToTokens> ToTokens for (A, B, C, D, E, F, G, H, I, J)
[src]

[src]

[src]

impl<A: ToTokens, B: ToTokens, C: ToTokens, D: ToTokens, E: ToTokens, F: ToTokens, G: ToTokens, H: ToTokens, I: ToTokens, J: ToTokens, K: ToTokens> ToTokens for (A, B, C, D, E, F, G, H, I, J, K)
[src]

[src]

[src]

impl<A: ToTokens, B: ToTokens, C: ToTokens, D: ToTokens, E: ToTokens, F: ToTokens, G: ToTokens, H: ToTokens, I: ToTokens, J: ToTokens, K: ToTokens, L: ToTokens> ToTokens for (A, B, C, D, E, F, G, H, I, J, K, L)
[src]

[src]

[src]

Implementors