Struct quote::Tokens [−][src]
pub struct Tokens(_);
Tokens produced by a quote!(...)
invocation.
Methods
impl Tokens
[src]
impl Tokens
pub fn new() -> Self
[src]
pub fn new() -> Self
Empty tokens.
pub fn append<T: AsRef<str>>(&mut self, token: T)
[src]
pub fn append<T: AsRef<str>>(&mut self, token: T)
For use by ToTokens
implementations.
struct X; impl ToTokens for X { fn to_tokens(&self, tokens: &mut Tokens) { tokens.append("a"); tokens.append("b"); tokens.append("c"); } } let tokens = quote!(#X); assert_eq!(tokens.as_str(), "a b c");
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.as_str(), "true false");
pub fn append_separated<T, I, S: AsRef<str>>(&mut self, iter: I, sep: S) where
T: ToTokens,
I: IntoIterator<Item = T>,
[src]
pub fn append_separated<T, I, S: AsRef<str>>(&mut self, iter: I, sep: S) 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_separated(&[true, false], ","); } } let tokens = quote!(#X); assert_eq!(tokens.as_str(), "true , false");
pub fn append_terminated<T, I, S: AsRef<str>>(&mut self, iter: I, term: S) where
T: ToTokens,
I: IntoIterator<Item = T>,
[src]
pub fn append_terminated<T, I, S: AsRef<str>>(&mut self, iter: I, term: S) 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_terminated(&[true, false], ","); } } let tokens = quote!(#X); assert_eq!(tokens.as_str(), "true , false ,");
pub fn as_str(&self) -> &str
[src]
pub fn as_str(&self) -> &str
pub fn into_string(self) -> String
[src]
pub fn into_string(self) -> String
pub fn parse<T: FromStr>(&self) -> Result<T, T::Err>
[src]
pub fn parse<T: FromStr>(&self) -> Result<T, T::Err>
Trait Implementations
impl Debug for Tokens
[src]
impl Debug for Tokens
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Tokens
[src]
impl Clone for Tokens
fn clone(&self) -> Tokens
[src]
fn clone(&self) -> Tokens
Returns 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)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl Eq for Tokens
[src]
impl Eq for Tokens
impl PartialEq for Tokens
[src]
impl PartialEq for Tokens
fn eq(&self, other: &Tokens) -> bool
[src]
fn eq(&self, other: &Tokens) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Tokens) -> bool
[src]
fn ne(&self, other: &Tokens) -> bool
This method tests for !=
.
impl Default for Tokens
[src]
impl Default for Tokens
impl Display for Tokens
[src]
impl Display for Tokens
fn fmt(&self, formatter: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, formatter: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl AsRef<str> for Tokens
[src]
impl AsRef<str> for Tokens
impl ToTokens for Tokens
[src]
impl ToTokens for Tokens