Trait quote::ToTokens
[−]
[src]
pub trait ToTokens { fn to_tokens(&self, &mut Tokens); }
Types that can be interpolated inside a quote!(...)
invocation.
Required Methods
fn to_tokens(&self, &mut Tokens)
Write self
to the given Tokens
.
Example implementation for a struct representing Rust paths like
std::cmp::PartialEq
:
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); } } }
Implementors
impl<'a, T: ?Sized + ToTokens> ToTokens for &'a T
impl<'a, T: ?Sized + ToOwned + ToTokens> ToTokens for Cow<'a, T>
impl<T: ?Sized + ToTokens> ToTokens for Box<T>
impl<T: ToTokens> ToTokens for Option<T>
impl ToTokens for str
impl ToTokens for String
impl ToTokens for char
impl<'a> ToTokens for ByteStr<'a>
impl ToTokens for Tokens
impl ToTokens for bool
impl ToTokens for i8
impl ToTokens for Hex<i8>
impl ToTokens for i16
impl ToTokens for Hex<i16>
impl ToTokens for i32
impl ToTokens for Hex<i32>
impl ToTokens for i64
impl ToTokens for Hex<i64>
impl ToTokens for isize
impl ToTokens for Hex<isize>
impl ToTokens for u8
impl ToTokens for Hex<u8>
impl ToTokens for u16
impl ToTokens for Hex<u16>
impl ToTokens for u32
impl ToTokens for Hex<u32>
impl ToTokens for u64
impl ToTokens for Hex<u64>
impl ToTokens for usize
impl ToTokens for Hex<usize>
impl ToTokens for f32
impl ToTokens for f64
impl<T: ToTokens> ToTokens for [T]
impl<T: ToTokens> ToTokens for Vec<T>
impl<T: ToTokens> ToTokens for [T; 0]
impl<T: ToTokens> ToTokens for [T; 1]
impl<T: ToTokens> ToTokens for [T; 2]
impl<T: ToTokens> ToTokens for [T; 3]
impl<T: ToTokens> ToTokens for [T; 4]
impl<T: ToTokens> ToTokens for [T; 5]
impl<T: ToTokens> ToTokens for [T; 6]
impl<T: ToTokens> ToTokens for [T; 7]
impl<T: ToTokens> ToTokens for [T; 8]
impl<T: ToTokens> ToTokens for [T; 9]
impl<T: ToTokens> ToTokens for [T; 10]
impl<T: ToTokens> ToTokens for [T; 11]
impl<T: ToTokens> ToTokens for [T; 12]
impl<T: ToTokens> ToTokens for [T; 13]
impl<T: ToTokens> ToTokens for [T; 14]
impl<T: ToTokens> ToTokens for [T; 15]
impl<T: ToTokens> ToTokens for [T; 16]
impl<T: ToTokens> ToTokens for [T; 17]
impl<T: ToTokens> ToTokens for [T; 18]
impl<T: ToTokens> ToTokens for [T; 19]
impl<T: ToTokens> ToTokens for [T; 20]
impl<T: ToTokens> ToTokens for [T; 21]
impl<T: ToTokens> ToTokens for [T; 22]
impl<T: ToTokens> ToTokens for [T; 23]
impl<T: ToTokens> ToTokens for [T; 24]
impl<T: ToTokens> ToTokens for [T; 25]
impl<T: ToTokens> ToTokens for [T; 26]
impl<T: ToTokens> ToTokens for [T; 27]
impl<T: ToTokens> ToTokens for [T; 28]
impl<T: ToTokens> ToTokens for [T; 29]
impl<T: ToTokens> ToTokens for [T; 30]
impl<T: ToTokens> ToTokens for [T; 31]
impl<T: ToTokens> ToTokens for [T; 32]
impl ToTokens for ()
impl<A: ToTokens> ToTokens for (A,)
impl<A: ToTokens, B: ToTokens> ToTokens for (A, B)
impl<A: ToTokens, B: ToTokens, C: ToTokens> ToTokens for (A, B, C)
impl<A: ToTokens, B: ToTokens, C: ToTokens, D: ToTokens> ToTokens for (A, B, C, D)
impl<A: ToTokens, B: ToTokens, C: ToTokens, D: ToTokens, E: ToTokens> ToTokens for (A, B, C, D, E)
impl<A: ToTokens, B: ToTokens, C: ToTokens, D: ToTokens, E: ToTokens, F: ToTokens> ToTokens for (A, B, C, D, E, F)
impl<A: ToTokens, B: ToTokens, C: ToTokens, D: ToTokens, E: ToTokens, F: ToTokens, G: ToTokens> ToTokens for (A, B, C, D, E, F, G)
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)
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)
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)
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)
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)
impl ToTokens for Ident