# Struct quote::Tokens [−] [src]

    pub struct Tokens(_);

Tokens produced by a `quote!(...)` invocation.

## Methods

### `impl Tokens`
[src]

#### `pub fn new() -> Self`
[src]

Empty tokens.

#### `pub fn append<T: AsRef<str>>(&mut self, token: T)`
[src]

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]

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]

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]

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 into_string(self) -> String`
[src]

#### `pub fn parse<T: FromStr>(&self) -> Result<T, T::Err>`
[src]

## Trait Implementations

### `impl Debug for Tokens`
[src]

#### `fn fmt(&self, __arg_0: &mut Formatter) -> Result`
[src]

Formats the value using the given formatter. Read more

### `impl Clone for Tokens`
[src]

#### `fn clone(&self) -> Tokens`
[src]

Returns a copy of the value. Read more

#### `fn clone_from(&mut self, source: &Self)`
1.0.0
[src]

Performs copy-assignment from `source`. Read more

### `impl Eq for Tokens`
[src]

### `impl PartialEq for Tokens`
[src]

#### `fn eq(&self, __arg_0: &Tokens) -> bool`
[src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `fn ne(&self, __arg_0: &Tokens) -> bool`
[src]

This method tests for `!=`.

### `impl Default for Tokens`
[src]

#### `fn default() -> Self`
[src]

Returns the "default value" for a type. Read more

### `impl Display for Tokens`
[src]

#### `fn fmt(&self, formatter: &mut Formatter) -> Result<(), Error>`
[src]

Formats the value using the given formatter. Read more

### `impl AsRef<str> for Tokens`
[src]

#### `fn as_ref(&self) -> &str`
[src]

Performs the conversion.

### `impl ToTokens for Tokens`
[src]

#### `fn to_tokens(&self, tokens: &mut Tokens)`
[src]

Write `self` to the given `Tokens`. Read more

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)