This commit is contained in:
2020-01-23 23:13:36 -08:00
parent dcc0df955e
commit 2bc9ebdc6b
31829 changed files with 1229378 additions and 17 deletions

3
doc/quote/all.html Normal file
View File

@@ -0,0 +1,3 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="List of all items in this crate"><meta name="keywords" content="rust, rustlang, rust-lang"><title>List of all items in this crate</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../quote/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span>
</span>
<span class='in-band'>List of all items</span></h1><h3 id='Traits'>Traits</h3><ul class='traits docblock'><li><a href='trait.ToTokens.html'>ToTokens</a></li><li><a href='trait.TokenStreamExt.html'>TokenStreamExt</a></li></ul><h3 id='Macros'>Macros</h3><ul class='macros docblock'><li><a href='macro.quote.html'>quote</a></li><li><a href='macro.quote_spanned.html'>quote_spanned</a></li></ul></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "quote";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../quote/trait.TokenStreamExt.html">
</head>
<body>
<p>Redirecting to <a href="../../quote/trait.TokenStreamExt.html">../../quote/trait.TokenStreamExt.html</a>...</p>
<script>location.replace("../../quote/trait.TokenStreamExt.html" + location.search + location.hash);</script>
</body>
</html>

72
doc/quote/index.html Normal file
View File

@@ -0,0 +1,72 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `quote` crate."><meta name="keywords" content="rust, rustlang, rust-lang, quote"><title>quote - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../quote/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Crate quote</p><div class="sidebar-elems"><a id='all-types' href='all.html'><p>See all quote's items</p></a><div class="block items"><ul><li><a href="#macros">Macros</a></li><li><a href="#traits">Traits</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'quote', ty: 'mod', relpath: '../'};</script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/quote/lib.rs.html#1-861' title='goto source code'>[src]</a></span><span class='in-band'>Crate <a class="mod" href=''>quote</a></span></h1><div class='docblock'><p>This crate provides the <a href="macro.quote.html"><code>quote!</code></a> macro for turning Rust syntax tree data
structures into tokens of source code.</p>
<p>Procedural macros in Rust receive a stream of tokens as input, execute
arbitrary Rust code to determine how to manipulate those tokens, and produce
a stream of tokens to hand back to the compiler to compile into the caller's
crate. Quasi-quoting is a solution to one piece of that -- producing tokens
to return to the compiler.</p>
<p>The idea of quasi-quoting is that we write <em>code</em> that we treat as <em>data</em>.
Within the <code>quote!</code> macro, we can write what looks like code to our text
editor or IDE. We get all the benefits of the editor's brace matching,
syntax highlighting, indentation, and maybe autocompletion. But rather than
compiling that as code into the current crate, we can treat it as data, pass
it around, mutate it, and eventually hand it back to the compiler as tokens
to compile into the macro caller's crate.</p>
<p>This crate is motivated by the procedural macro use case, but is a
general-purpose Rust quasi-quoting library and is not specific to procedural
macros.</p>
<p><em>Version requirement: Quote supports any compiler version back to Rust's
very first support for procedural macros in Rust 1.15.0.</em></p>
<pre><code class="language-toml">[dependencies]
quote = &quot;0.6&quot;
</code></pre>
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
<p>The following quasi-quoted block of code is something you might find in <a href="https://serde.rs/">a</a>
procedural macro having to do with data structure serialization. The <code>#var</code>
syntax performs interpolation of runtime variables into the quoted tokens.
Check out the documentation of the <a href="macro.quote.html"><code>quote!</code></a> macro for more detail about
the syntax. See also the <a href="macro.quote_spanned.html"><code>quote_spanned!</code></a> macro which is important for
implementing hygienic procedural macros.</p>
<pre><code class="language-edition2018"># use quote::quote;
#
# let generics = &quot;&quot;;
# let where_clause = &quot;&quot;;
# let field_ty = &quot;&quot;;
# let item_ty = &quot;&quot;;
# let path = &quot;&quot;;
# let value = &quot;&quot;;
#
let tokens = quote! {
struct SerializeWith #generics #where_clause {
value: &amp;'a #field_ty,
phantom: core::marker::PhantomData&lt;#item_ty&gt;,
}
impl #generics serde::Serialize for SerializeWith #generics #where_clause {
fn serialize&lt;S&gt;(&amp;self, serializer: S) -&gt; Result&lt;S::Ok, S::Error&gt;
where
S: serde::Serializer,
{
#path(self.value, serializer)
}
}
SerializeWith {
value: #value,
phantom: core::marker::PhantomData::&lt;#item_ty&gt;,
}
};
</code></pre>
<h1 id="recursion-limit" class="section-header"><a href="#recursion-limit">Recursion limit</a></h1>
<p>The <code>quote!</code> macro relies on deep recursion so some large invocations may
fail with &quot;recursion limit reached&quot; when you compile. If it fails, bump up
the recursion limit by adding <code>#![recursion_limit = &quot;128&quot;]</code> to your crate.
An even higher limit may be necessary for especially large invocations.</p>
</div><h2 id='macros' class='section-header'><a href="#macros">Macros</a></h2>
<table><tr class='module-item'><td><a class="macro" href="macro.quote.html" title='quote::quote macro'>quote</a></td><td class='docblock-short'><p>The whole point.</p>
</td></tr><tr class='module-item'><td><a class="macro" href="macro.quote_spanned.html" title='quote::quote_spanned macro'>quote_spanned</a></td><td class='docblock-short'><p>Same as <code>quote!</code>, but applies a given span to all tokens originating within
the macro invocation.</p>
</td></tr></table><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
<table><tr class='module-item'><td><a class="trait" href="trait.ToTokens.html" title='quote::ToTokens trait'>ToTokens</a></td><td class='docblock-short'><p>Types that can be interpolated inside a <a href="macro.quote.html"><code>quote!</code></a> invocation.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.TokenStreamExt.html" title='quote::TokenStreamExt trait'>TokenStreamExt</a></td><td class='docblock-short'><p>TokenStream extension trait with methods for appending tokens.</p>
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "quote";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=macro.quote.html">
</head>
<body>
<p>Redirecting to <a href="macro.quote.html">macro.quote.html</a>...</p>
<script>location.replace("macro.quote.html" + location.search + location.hash);</script>
</body>
</html>

186
doc/quote/macro.quote.html Normal file
View File

@@ -0,0 +1,186 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `quote` macro in crate `quote`."><meta name="keywords" content="rust, rustlang, rust-lang, quote"><title>quote::quote - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc macro"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../quote/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='index.html'>quote</a></p><script>window.sidebarCurrent = {name: 'quote', ty: 'macro', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/quote/lib.rs.html#335-339' title='goto source code'>[src]</a></span><span class='in-band'>Macro <a href='index.html'>quote</a>::<wbr><a class="macro" href=''>quote</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><div class="example-wrap"><pre class="rust macro">
<span class="macro">macro_rules</span><span class="macro">!</span> <span class="ident">quote</span> {
($(<span class="macro-nonterminal">$</span><span class="macro-nonterminal">tt</span>:<span class="ident">tt</span>)<span class="kw-2">*</span>) <span class="op">=</span><span class="op">&gt;</span> { ... };
}</pre></div>
</div><div class='docblock'><p>The whole point.</p>
<p>Performs variable interpolation against the input and produces it as
<a href="https://docs.rs/proc-macro2/0.4/proc_macro2/struct.TokenStream.html"><code>TokenStream</code></a>. For returning tokens to the compiler in a procedural macro, use
<code>into()</code> to build a <code>TokenStream</code>.</p>
<h1 id="interpolation" class="section-header"><a href="#interpolation">Interpolation</a></h1>
<p>Variable interpolation is done with <code>#var</code> (similar to <code>$var</code> in
<code>macro_rules!</code> macros). This grabs the <code>var</code> variable that is currently in
scope and inserts it in that location in the output tokens. Any type
implementing the <a href="trait.ToTokens.html"><code>ToTokens</code></a> trait can be interpolated. This includes most
Rust primitive types as well as most of the syntax tree types from the <a href="https://github.com/dtolnay/syn">Syn</a>
crate.</p>
<p>Repetition is done using <code>#(...)*</code> or <code>#(...),*</code> again similar to
<code>macro_rules!</code>. This iterates through the elements of any variable
interpolated within the repetition and inserts a copy of the repetition body
for each one. The variables in an interpolation may be anything that
implements <code>IntoIterator</code>, including <code>Vec</code> or a pre-existing iterator.</p>
<ul>
<li><code>#(#var)*</code> — no separators</li>
<li><code>#(#var),*</code> — the character before the asterisk is used as a separator</li>
<li><code>#( struct #var; )*</code> — the repetition can contain other tokens</li>
<li><code>#( #k =&gt; println!(&quot;{}&quot;, #v), )*</code> — even multiple interpolations</li>
</ul>
<p>There are two limitations around interpolations in a repetition:</p>
<ul>
<li>
<p>Every interpolation inside of a repetition must be a distinct variable.
That is, <code>#(#a #a)*</code> is not allowed. Work around this by collecting <code>a</code>
into a vector and taking references <code>a1 = &amp;a</code> and <code>a2 = &amp;a</code> which you use
inside the repetition: <code>#(#a1 #a2)*</code>. Where possible, use meaningful names
that indicate the distinct role of each copy.</p>
</li>
<li>
<p>Every interpolation inside of a repetition must be iterable. If we have
<code>vec</code> which is a vector and <code>ident</code> which is a single identifier,
<code>#(#ident #vec)*</code> is not allowed. Work around this by using
<code>std::iter::repeat(ident)</code> to produce an iterable that can be used from
within the repetition.</p>
</li>
</ul>
<h1 id="hygiene" class="section-header"><a href="#hygiene">Hygiene</a></h1>
<p>Any interpolated tokens preserve the <code>Span</code> information provided by their
<code>ToTokens</code> implementation. Tokens that originate within the <code>quote!</code>
invocation are spanned with <a href="https://docs.rs/proc-macro2/0.4/proc_macro2/struct.Span.html#method.call_site"><code>Span::call_site()</code></a>.</p>
<p>A different span can be provided through the <a href="macro.quote_spanned.html"><code>quote_spanned!</code></a> macro.</p>
<h1 id="return-type" class="section-header"><a href="#return-type">Return type</a></h1>
<p>The macro evaluates to an expression of type <code>proc_macro2::TokenStream</code>.
Meanwhile Rust procedural macros are expected to return the type
<code>proc_macro::TokenStream</code>.</p>
<p>The difference between the two types is that <code>proc_macro</code> types are entirely
specific to procedural macros and cannot ever exist in code outside of a
procedural macro, while <code>proc_macro2</code> types may exist anywhere including
tests and non-macro code like main.rs and build.rs. This is why even the
procedural macro ecosystem is largely built around <code>proc_macro2</code>, because
that ensures the libraries are unit testable and accessible in non-macro
contexts.</p>
<p>There is a <a href="https://doc.rust-lang.org/std/convert/trait.From.html"><code>From</code></a>-conversion in both directions so returning the output of
<code>quote!</code> from a procedural macro usually looks like <code>tokens.into()</code> or
<code>proc_macro::TokenStream::from(tokens)</code>.</p>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1><h2 id="procedural-macro" class="section-header"><a href="#procedural-macro">Procedural macro</a></h2>
<p>The structure of a basic procedural macro is as follows. Refer to the <a href="https://github.com/dtolnay/syn">Syn</a>
crate for further useful guidance on using <code>quote!</code> as part of a procedural
macro.</p>
<pre><code class="language-edition2018"># #[cfg(any())]
extern crate proc_macro;
# use proc_macro2 as proc_macro;
use proc_macro::TokenStream;
use quote::quote;
# const IGNORE_TOKENS: &amp;'static str = stringify! {
#[proc_macro_derive(HeapSize)]
# };
pub fn derive_heap_size(input: TokenStream) -&gt; TokenStream {
// Parse the input and figure out what implementation to generate...
# const IGNORE_TOKENS: &amp;'static str = stringify! {
let name = /* ... */;
let expr = /* ... */;
# };
#
# let name = 0;
# let expr = 0;
let expanded = quote! {
// The generated impl.
impl heapsize::HeapSize for #name {
fn heap_size_of_children(&amp;self) -&gt; usize {
#expr
}
}
};
// Hand the output tokens back to the compiler.
TokenStream::from(expanded)
}
</code></pre>
<h2 id="combining-quoted-fragments" class="section-header"><a href="#combining-quoted-fragments">Combining quoted fragments</a></h2>
<p>Usually you don't end up constructing an entire final <code>TokenStream</code> in one
piece. Different parts may come from different helper functions. The tokens
produced by <code>quote!</code> themselves implement <code>ToTokens</code> and so can be
interpolated into later <code>quote!</code> invocations to build up a final result.</p>
<pre><code class="language-edition2018"># use quote::quote;
#
let type_definition = quote! {...};
let methods = quote! {...};
let tokens = quote! {
#type_definition
#methods
};
</code></pre>
<h2 id="constructing-identifiers" class="section-header"><a href="#constructing-identifiers">Constructing identifiers</a></h2>
<p>Suppose we have an identifier <code>ident</code> which came from somewhere in a macro
input and we need to modify it in some way for the macro output. Let's
consider prepending the identifier with an underscore.</p>
<p>Simply interpolating the identifier next to an underscore will not have the
behavior of concatenating them. The underscore and the identifier will
continue to be two separate tokens as if you had written <code>_ x</code>.</p>
<pre><code class="language-edition2018"># use proc_macro2::{self as syn, Span};
# use quote::quote;
#
# let ident = syn::Ident::new(&quot;i&quot;, Span::call_site());
#
// incorrect
quote! {
let mut _#ident = 0;
}
# ;
</code></pre>
<p>The solution is to perform token-level manipulations using the APIs provided
by Syn and proc-macro2.</p>
<pre><code class="language-edition2018"># use proc_macro2::{self as syn, Span};
# use quote::quote;
#
# let ident = syn::Ident::new(&quot;i&quot;, Span::call_site());
#
let concatenated = format!(&quot;_{}&quot;, ident);
let varname = syn::Ident::new(&amp;concatenated, ident.span());
quote! {
let mut #varname = 0;
}
# ;
</code></pre>
<h2 id="making-method-calls" class="section-header"><a href="#making-method-calls">Making method calls</a></h2>
<p>Let's say our macro requires some type specified in the macro input to have
a constructor called <code>new</code>. We have the type in a variable called
<code>field_type</code> of type <code>syn::Type</code> and want to invoke the constructor.</p>
<pre><code class="language-edition2018"># use quote::quote;
#
# let field_type = quote!(...);
#
// incorrect
quote! {
let value = #field_type::new();
}
# ;
</code></pre>
<p>This works only sometimes. If <code>field_type</code> is <code>String</code>, the expanded code
contains <code>String::new()</code> which is fine. But if <code>field_type</code> is something
like <code>Vec&lt;i32&gt;</code> then the expanded code is <code>Vec&lt;i32&gt;::new()</code> which is invalid
syntax. Ordinarily in handwritten Rust we would write <code>Vec::&lt;i32&gt;::new()</code>
but for macros often the following is more convenient.</p>
<pre><code class="language-edition2018"># use quote::quote;
#
# let field_type = quote!(...);
#
quote! {
let value = &lt;#field_type&gt;::new();
}
# ;
</code></pre>
<p>This expands to <code>&lt;Vec&lt;i32&gt;&gt;::new()</code> which behaves correctly.</p>
<p>A similar pattern is appropriate for trait methods.</p>
<pre><code class="language-edition2018"># use quote::quote;
#
# let field_type = quote!(...);
#
quote! {
let value = &lt;#field_type as core::default::Default&gt;::default();
}
# ;
</code></pre>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "quote";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=macro.quote_spanned.html">
</head>
<body>
<p>Redirecting to <a href="macro.quote_spanned.html">macro.quote_spanned.html</a>...</p>
<script>location.replace("macro.quote_spanned.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,79 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `quote_spanned` macro in crate `quote`."><meta name="keywords" content="rust, rustlang, rust-lang, quote_spanned"><title>quote::quote_spanned - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc macro"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../quote/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='index.html'>quote</a></p><script>window.sidebarCurrent = {name: 'quote_spanned', ty: 'macro', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/quote/lib.rs.html#435-442' title='goto source code'>[src]</a></span><span class='in-band'>Macro <a href='index.html'>quote</a>::<wbr><a class="macro" href=''>quote_spanned</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><div class="example-wrap"><pre class="rust macro">
<span class="macro">macro_rules</span><span class="macro">!</span> <span class="ident">quote_spanned</span> {
(<span class="macro-nonterminal">$</span><span class="macro-nonterminal">span</span>:<span class="ident">expr</span><span class="op">=</span><span class="op">&gt;</span> $(<span class="macro-nonterminal">$</span><span class="macro-nonterminal">tt</span>:<span class="ident">tt</span>)<span class="kw-2">*</span>) <span class="op">=</span><span class="op">&gt;</span> { ... };
}</pre></div>
</div><div class='docblock'><p>Same as <code>quote!</code>, but applies a given span to all tokens originating within
the macro invocation.</p>
<h1 id="syntax" class="section-header"><a href="#syntax">Syntax</a></h1>
<p>A span expression of type <a href="https://docs.rs/proc-macro2/0.4/proc_macro2/struct.Span.html"><code>Span</code></a>, followed by <code>=&gt;</code>, followed by the tokens
to quote. The span expression should be brief -- use a variable for anything
more than a few characters. There should be no space before the <code>=&gt;</code> token.</p>
<pre><code class="language-edition2018"># use proc_macro2::Span;
# use quote::quote_spanned;
#
# const IGNORE_TOKENS: &amp;'static str = stringify! {
let span = /* ... */;
# };
# let span = Span::call_site();
# let init = 0;
// On one line, use parentheses.
let tokens = quote_spanned!(span=&gt; Box::into_raw(Box::new(#init)));
// On multiple lines, place the span at the top and use braces.
let tokens = quote_spanned! {span=&gt;
Box::into_raw(Box::new(#init))
};
</code></pre>
<p>The lack of space before the <code>=&gt;</code> should look jarring to Rust programmers
and this is intentional. The formatting is designed to be visibly
off-balance and draw the eye a particular way, due to the span expression
being evaluated in the context of the procedural macro and the remaining
tokens being evaluated in the generated code.</p>
<h1 id="hygiene" class="section-header"><a href="#hygiene">Hygiene</a></h1>
<p>Any interpolated tokens preserve the <code>Span</code> information provided by their
<code>ToTokens</code> implementation. Tokens that originate within the <code>quote_spanned!</code>
invocation are spanned with the given span argument.</p>
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
<p>The following procedural macro code uses <code>quote_spanned!</code> to assert that a
particular Rust type implements the <a href="https://doc.rust-lang.org/std/marker/trait.Sync.html"><code>Sync</code></a> trait so that references can be
safely shared between threads.</p>
<pre><code class="language-edition2018"># use quote::{quote_spanned, TokenStreamExt, ToTokens};
# use proc_macro2::{Span, TokenStream};
#
# struct Type;
#
# impl Type {
# fn span(&amp;self) -&gt; Span {
# Span::call_site()
# }
# }
#
# impl ToTokens for Type {
# fn to_tokens(&amp;self, _tokens: &amp;mut TokenStream) {}
# }
#
# let ty = Type;
# let call_site = Span::call_site();
#
let ty_span = ty.span();
let assert_sync = quote_spanned! {ty_span=&gt;
struct _AssertSync where #ty: Sync;
};
</code></pre>
<p>If the assertion fails, the user will see an error like the following. The
input span of their type is hightlighted in the error.</p>
<pre><code class="language-text">error[E0277]: the trait bound `*const (): std::marker::Sync` is not satisfied
--&gt; src/main.rs:10:21
|
10 | static ref PTR: *const () = &amp;();
| ^^^^^^^^^ `*const ()` cannot be shared between threads safely
</code></pre>
<p>In this example it is important for the where-clause to be spanned with the
line/column information of the user's input type so that error messages are
placed appropriately by the compiler. But it is also incredibly important
that <code>Sync</code> resolves at the macro definition site and not the macro call
site. If we resolve <code>Sync</code> at the same span that the user's type is going to
be resolved, then they could bypass our check by defining their own trait
named <code>Sync</code> that is implemented for their type.</p>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "quote";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>

View File

@@ -0,0 +1 @@
initSidebarItems({"macro":[["quote","The whole point."],["quote_spanned","Same as `quote!`, but applies a given span to all tokens originating within the macro invocation."]],"trait":[["ToTokens","Types that can be interpolated inside a [`quote!`] invocation."],["TokenStreamExt","TokenStream extension trait with methods for appending tokens."]]});

View File

@@ -0,0 +1,59 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `Tokens` struct in crate `quote`."><meta name="keywords" content="rust, rustlang, rust-lang, Tokens"><title>quote::Tokens - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../quote/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Struct Tokens</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.append">append</a><a href="#method.append_all">append_all</a><a href="#method.append_separated">append_separated</a><a href="#method.append_terminated">append_terminated</a><a href="#method.new">new</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a><a href="#impl-Default">Default</a><a href="#impl-Display">Display</a><a href="#impl-From%3CTokens%3E">From&lt;Tokens&gt;</a><a href="#impl-Hash">Hash</a><a href="#impl-IntoIterator">IntoIterator</a><a href="#impl-PartialEq%3CTokens%3E">PartialEq&lt;Tokens&gt;</a><a href="#impl-ToTokens">ToTokens</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">!Send</a><a href="#impl-Sync">!Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-IntoIterator">IntoIterator</a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-ToString">ToString</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class='location'><a href='index.html'>quote</a></p><script>window.sidebarCurrent = {name: 'Tokens', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/quote/tokens.rs.html#12-14' title='goto source code'>[src]</a></span><span class='in-band'>Struct <a href='index.html'>quote</a>::<wbr><a class="struct" href=''>Tokens</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust struct'>pub struct Tokens { /* fields omitted */ }</pre></div><div class='docblock'><p>Tokens produced by a <a href="macro.quote.html"><code>quote!</code></a> invocation.</p>
</div><h2 id='methods' class='small-section-header'>Methods<a href='#methods' class='anchor'></a></h2><h3 id='impl' class='impl'><code class='in-band'>impl <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a></code><a href='#impl' class='anchor'></a><a class='srclink' href='../src/quote/tokens.rs.html#16-93' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.new' class="method"><code id='new.v'>pub fn <a href='#method.new' class='fnname'>new</a>() -&gt; Self</code><a class='srclink' href='../src/quote/tokens.rs.html#18-20' title='goto source code'>[src]</a></h4><div class='docblock'><p>Empty tokens.</p>
</div><h4 id='method.append' class="method"><code id='append.v'>pub fn <a href='#method.append' class='fnname'>append</a>&lt;U&gt;(&amp;mut self, token: U) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../proc_macro2/struct.TokenTree.html" title="struct proc_macro2::TokenTree">TokenTree</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/quote/tokens.rs.html#25-30' title='goto source code'>[src]</a></h4><div class='docblock'><p>For use by <code>ToTokens</code> implementations.</p>
<p>Appends the token specified to this list of tokens.</p>
</div><h4 id='method.append_all' class="method"><code id='append_all.v'>pub fn <a href='#method.append_all' class='fnname'>append_all</a>&lt;T, I&gt;(&amp;mut self, iter: I) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = T&gt;,&nbsp;</span></code><a class='srclink' href='../src/quote/tokens.rs.html#50-58' title='goto source code'>[src]</a></h4><div class='docblock'><p>For use by <code>ToTokens</code> implementations.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">struct</span> <span class="ident">X</span>;
<span class="kw">impl</span> <span class="ident">ToTokens</span> <span class="kw">for</span> <span class="ident">X</span> {
<span class="kw">fn</span> <span class="ident">to_tokens</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">tokens</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">Tokens</span>) {
<span class="ident">tokens</span>.<span class="ident">append_all</span>(<span class="kw-2">&amp;</span>[<span class="bool-val">true</span>, <span class="bool-val">false</span>]);
}
}
<span class="kw">let</span> <span class="ident">tokens</span> <span class="op">=</span> <span class="macro">quote</span><span class="macro">!</span>(#<span class="ident">X</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">tokens</span>.<span class="ident">to_string</span>(), <span class="string">&quot;true false&quot;</span>);</pre></div>
</div><h4 id='method.append_separated' class="method"><code id='append_separated.v'>pub fn <a href='#method.append_separated' class='fnname'>append_separated</a>&lt;T, I, U&gt;(&amp;mut self, iter: I, op: U) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = T&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,&nbsp;</span></code><a class='srclink' href='../src/quote/tokens.rs.html#64-76' title='goto source code'>[src]</a></h4><div class='docblock'><p>For use by <code>ToTokens</code> implementations.</p>
<p>Appends all of the items in the iterator <code>I</code>, separated by the tokens
<code>U</code>.</p>
</div><h4 id='method.append_terminated' class="method"><code id='append_terminated.v'>pub fn <a href='#method.append_terminated' class='fnname'>append_terminated</a>&lt;T, I, U&gt;(&amp;mut self, iter: I, term: U) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = T&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,&nbsp;</span></code><a class='srclink' href='../src/quote/tokens.rs.html#82-92' title='goto source code'>[src]</a></h4><div class='docblock'><p>For use by <code>ToTokens</code> implementations.</p>
<p>Appends all tokens in the iterator <code>I</code>, appending <code>U</code> after each
element, including after the last element of the iterator.</p>
</div></div><h2 id='implementations' class='small-section-header'>Trait Implementations<a href='#implementations' class='anchor'></a></h2><div id='implementations-list'><h3 id='impl-ToTokens' class='impl'><code class='in-band'>impl <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a> for <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a></code><a href='#impl-ToTokens' class='anchor'></a><a class='srclink' href='../src/quote/tokens.rs.html#95-103' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.to_tokens' class="method hidden"><code id='to_tokens.v'>fn <a href='../quote/trait.ToTokens.html#tymethod.to_tokens' class='fnname'>to_tokens</a>(&amp;self, dst: &amp;mut <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a>)</code><a class='srclink' href='../src/quote/tokens.rs.html#96-98' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Write <code>self</code> to the given <code>Tokens</code>. <a href="../quote/trait.ToTokens.html#tymethod.to_tokens">Read more</a></p>
</div><h4 id='method.into_tokens' class="method hidden"><code id='into_tokens.v'>fn <a href='../quote/trait.ToTokens.html#method.into_tokens' class='fnname'>into_tokens</a>(self) -&gt; <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a></code><a class='srclink' href='../src/quote/tokens.rs.html#100-102' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Convert <code>self</code> directly into a <code>Tokens</code> object. <a href="../quote/trait.ToTokens.html#method.into_tokens">Read more</a></p>
</div></div><h3 id='impl-Default' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a></code><a href='#impl-Default' class='anchor'></a><a class='srclink' href='../src/quote/tokens.rs.html#11' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.default' class="method hidden"><code id='default.v'>fn <a href='https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default' class='fnname'>default</a>() -&gt; <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a></code><a class='srclink' href='../src/quote/tokens.rs.html#11' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Returns the &quot;default value&quot; for a type. <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default">Read more</a></p>
</div></div><h3 id='impl-Clone' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a></code><a href='#impl-Clone' class='anchor'></a><a class='srclink' href='../src/quote/tokens.rs.html#11' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.clone' class="method hidden"><code id='clone.v'>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&amp;self) -&gt; <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a></code><a class='srclink' href='../src/quote/tokens.rs.html#11' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id='method.clone_from' class="method hidden"><code id='clone_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self)</code><span class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/clone.rs.html#131-133' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div><h3 id='impl-PartialEq%3CTokens%3E' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a>&gt; for <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a></code><a href='#impl-PartialEq%3CTokens%3E' class='anchor'></a><a class='srclink' href='../src/quote/tokens.rs.html#213-224' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.eq' class="method hidden"><code id='eq.v'>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class='srclink' href='../src/quote/tokens.rs.html#214-223' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
</div><h4 id='method.ne' class="method hidden"><code id='ne.v'><span class="docblock attributes">#[must_use]
</span>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Rhs) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><span class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#208' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>This method tests for <code>!=</code>.</p>
</div></div><h3 id='impl-IntoIterator' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> for <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a></code><a href='#impl-IntoIterator' class='anchor'></a><a class='srclink' href='../src/quote/tokens.rs.html#118-125' title='goto source code'>[src]</a></h3><div class='docblock'><p>Allows a <code>Tokens</code> to be passed to <code>Tokens::append_all</code>.</p>
</div><div class='impl-items'><h4 id='associatedtype.Item' class="type"><code id='Item.t'>type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item' class="type">Item</a> = <a class="struct" href="../proc_macro2/struct.TokenTree.html" title="struct proc_macro2::TokenTree">TokenTree</a></code></h4><div class='docblock'><p>The type of the elements being iterated over.</p>
</div><h4 id='associatedtype.IntoIter' class="type"><code id='IntoIter.t'>type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter' class="type">IntoIter</a> = IntoIter</code></h4><div class='docblock'><p>Which kind of iterator are we turning this into?</p>
</div><h4 id='method.into_iter' class="method hidden"><code id='into_iter.v'>fn <a href='https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter' class='fnname'>into_iter</a>(self) -&gt; Self::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a></code><a class='srclink' href='../src/quote/tokens.rs.html#122-124' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Creates an iterator from a value. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter">Read more</a></p>
</div></div><h3 id='impl-From%3CTokens%3E' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a>&gt; for <a class="struct" href="../proc_macro2/struct.TokenStream.html" title="struct proc_macro2::TokenStream">TokenStream</a></code><a href='#impl-From%3CTokens%3E' class='anchor'></a><a class='srclink' href='../src/quote/tokens.rs.html#105-109' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from' class="method hidden"><code id='from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(tokens: <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a>) -&gt; <a class="struct" href="../proc_macro2/struct.TokenStream.html" title="struct proc_macro2::TokenStream">TokenStream</a></code><a class='srclink' href='../src/quote/tokens.rs.html#106-108' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-From%3CTokens%3E-1' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a>&gt; for <a class="struct" href="https://doc.rust-lang.org/nightly/proc_macro/struct.TokenStream.html" title="struct proc_macro::TokenStream">TokenStream</a></code><a href='#impl-From%3CTokens%3E-1' class='anchor'></a><a class='srclink' href='../src/quote/tokens.rs.html#111-115' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-1' class="method hidden"><code id='from.v-1'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(tokens: <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/proc_macro/struct.TokenStream.html" title="struct proc_macro::TokenStream">TokenStream</a></code><a class='srclink' href='../src/quote/tokens.rs.html#112-114' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-Hash' class='impl'><code class='in-band'>impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> for <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a></code><a href='#impl-Hash' class='anchor'></a><a class='srclink' href='../src/quote/tokens.rs.html#257-264' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.hash' class="method hidden"><code id='hash.v'>fn <a href='https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#tymethod.hash' class='fnname'>hash</a>&lt;H:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>&gt;(&amp;self, h: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>H)</code><a class='srclink' href='../src/quote/tokens.rs.html#258-263' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Feeds this value into the given [<code>Hasher</code>]. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#tymethod.hash">Read more</a></p>
</div><h4 id='method.hash_slice' class="method hidden"><code id='hash_slice.v'>fn <a href='https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice' class='fnname'>hash_slice</a>&lt;H&gt;(data: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[Self]</a>, state: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>H) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>,&nbsp;</span></code><span class='since' title='Stable since Rust version 1.3.0'>1.3.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/hash/mod.rs.html#192-198' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Feeds a slice of this type into the given [<code>Hasher</code>]. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice">Read more</a></p>
</div></div><h3 id='impl-Debug' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a></code><a href='#impl-Debug' class='anchor'></a><a class='srclink' href='../src/quote/tokens.rs.html#152-170' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.fmt' class="method hidden"><code id='fmt.v'>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, formatter: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class='srclink' href='../src/quote/tokens.rs.html#153-169' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
</div></div><h3 id='impl-Display' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a></code><a href='#impl-Display' class='anchor'></a><a class='srclink' href='../src/quote/tokens.rs.html#146-150' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.fmt-1' class="method hidden"><code id='fmt.v-1'>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, formatter: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class='srclink' href='../src/quote/tokens.rs.html#147-149' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></p>
</div></div></div><h2 id='synthetic-implementations' class='small-section-header'>Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a></h2><div id='synthetic-implementations-list'><h3 id='impl-Send' class='impl'><code class='in-band'>impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a></code><a href='#impl-Send' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Unpin' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a></code><a href='#impl-Unpin' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><code class='in-band'>impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a></code><a href='#impl-Sync' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-UnwindSafe' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a></code><a href='#impl-UnwindSafe' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-RefUnwindSafe' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../quote/struct.Tokens.html" title="struct quote::Tokens">Tokens</a></code><a href='#impl-RefUnwindSafe' class='anchor'></a></h3><div class='impl-items'></div></div><h2 id='blanket-implementations' class='small-section-header'>Blanket Implementations<a href='#blanket-implementations' class='anchor'></a></h2><div id='blanket-implementations-list'><h3 id='impl-ToOwned' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,&nbsp;</span></code><a href='#impl-ToOwned' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#81-92' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Owned' class="type"><code id='Owned.t'>type <a href='https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned' class="type">Owned</a> = T</code></h4><div class='docblock'><p>The resulting type after obtaining ownership.</p>
</div><h4 id='method.to_owned' class="method hidden"><code id='to_owned.v'>fn <a href='https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned' class='fnname'>to_owned</a>(&amp;self) -&gt; T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#85-87' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
</div><h4 id='method.clone_into' class="method hidden"><code id='clone_into.v'>fn <a href='https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into' class='fnname'>clone_into</a>(&amp;self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T)</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#89-91' title='goto source code'>[src]</a></h4><div class='stability hidden'><div class='stab unstable'><details><summary><span class='emoji'>🔬</span> This is a nightly-only experimental API. (<code>toowned_clone_into</code>)</summary><p>recently added</p>
</details></div></div><div class='docblock hidden'><p>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></p>
</div></div><h3 id='impl-Into%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-Into%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#544-549' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.into' class="method hidden"><code id='into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into' class='fnname'>into</a>(self) -&gt; U</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#546-548' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-IntoIterator-1' class='impl'><code class='in-band'>impl&lt;I&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> for I <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,&nbsp;</span></code><a href='#impl-IntoIterator-1' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/iter/traits/collect.rs.html#242-249' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Item-1' class="type"><code id='Item.t-1'>type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a></code></h4><div class='docblock'><p>The type of the elements being iterated over.</p>
</div><h4 id='associatedtype.IntoIter-1' class="type"><code id='IntoIter.t-1'>type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter' class="type">IntoIter</a> = I</code></h4><div class='docblock'><p>Which kind of iterator are we turning this into?</p>
</div><h4 id='method.into_iter-1' class="method hidden"><code id='into_iter.v-1'>fn <a href='https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter' class='fnname'>into_iter</a>(self) -&gt; I</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/iter/traits/collect.rs.html#246-248' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Creates an iterator from a value. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter">Read more</a></p>
</div></div><h3 id='impl-From%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</code><a href='#impl-From%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#553-555' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-2' class="method hidden"><code id='from.v-2'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(t: T) -&gt; T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#554' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-ToString' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html" title="trait alloc::string::ToString">ToString</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-ToString' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2134-2144' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.to_string' class="method hidden"><code id='to_string.v'>default fn <a href='https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string' class='fnname'>to_string</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2136-2143' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Converts the given value to a <code>String</code>. <a href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string">Read more</a></p>
</div></div><h3 id='impl-TryFrom%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-TryFrom%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#572-578' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error' class="type"><code id='Error.t'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error' class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id='method.try_from' class="method hidden"><code id='try_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from' class='fnname'>try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#575-577' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-TryInto%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-TryInto%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#560-567' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error-1' class="type"><code id='Error.t-1'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error' class="type">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id='method.try_into' class="method hidden"><code id='try_into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into' class='fnname'>try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#564-566' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-BorrowMut%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-BorrowMut%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#218-220' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow_mut' class="method hidden"><code id='borrow_mut.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut' class='fnname'>borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#219' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
</div></div><h3 id='impl-Borrow%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Borrow%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#213-215' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow' class="method hidden"><code id='borrow.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
</div></div><h3 id='impl-Any' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Any' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#100-102' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.type_id' class="method hidden"><code id='type_id.v'>fn <a href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id' class='fnname'>type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#101' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "quote";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../quote/trait.ToTokens.html">
</head>
<body>
<p>Redirecting to <a href="../../quote/trait.ToTokens.html">../../quote/trait.ToTokens.html</a>...</p>
<script>location.replace("../../quote/trait.ToTokens.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../quote/struct.Tokens.html">
</head>
<body>
<p>Redirecting to <a href="../../quote/struct.Tokens.html">../../quote/struct.Tokens.html</a>...</p>
<script>location.replace("../../quote/struct.Tokens.html" + location.search + location.hash);</script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,36 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `TokenStreamExt` trait in crate `quote`."><meta name="keywords" content="rust, rustlang, rust-lang, TokenStreamExt"><title>quote::TokenStreamExt - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../quote/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Trait TokenStreamExt</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.append">append</a><a href="#tymethod.append_all">append_all</a><a href="#tymethod.append_separated">append_separated</a><a href="#tymethod.append_terminated">append_terminated</a></div><a class="sidebar-title" href="#foreign-impls">Implementations on Foreign Types</a><div class="sidebar-links"><a href="#impl-TokenStreamExt-for-TokenStream">TokenStream</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='index.html'>quote</a></p><script>window.sidebarCurrent = {name: 'TokenStreamExt', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/quote/ext.rs.html#10-59' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='index.html'>quote</a>::<wbr><a class="trait" href=''>TokenStreamExt</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'>pub trait TokenStreamExt: Sealed {
fn <a href='#tymethod.append' class='fnname'>append</a>&lt;U&gt;(&amp;mut self, token: U)<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="../proc_macro2/enum.TokenTree.html" title="enum proc_macro2::TokenTree">TokenTree</a>&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.append_all' class='fnname'>append_all</a>&lt;T, I&gt;(&amp;mut self, iter: I)<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = T&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.append_separated' class='fnname'>append_separated</a>&lt;T, I, U&gt;(&amp;mut self, iter: I, op: U)<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = T&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a></span>;
<div class='item-spacer'></div> fn <a href='#tymethod.append_terminated' class='fnname'>append_terminated</a>&lt;T, I, U&gt;(&amp;mut self, iter: I, term: U)<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = T&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a></span>;
}</pre></div><div class='docblock'><p>TokenStream extension trait with methods for appending tokens.</p>
<p>This trait is sealed and cannot be implemented outside of the <code>quote</code> crate.</p>
</div>
<h2 id='required-methods' class='small-section-header'>Required methods<a href='#required-methods' class='anchor'></a></h2><div class='methods'><h3 id='tymethod.append' class='method'><code id='append.v'>fn <a href='#tymethod.append' class='fnname'>append</a>&lt;U&gt;(&amp;mut self, token: U) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="../proc_macro2/enum.TokenTree.html" title="enum proc_macro2::TokenTree">TokenTree</a>&gt;,&nbsp;</span></code></h3><div class='docblock'><p>For use by <code>ToTokens</code> implementations.</p>
<p>Appends the token specified to this list of tokens.</p>
</div><h3 id='tymethod.append_all' class='method'><code id='append_all.v'>fn <a href='#tymethod.append_all' class='fnname'>append_all</a>&lt;T, I&gt;(&amp;mut self, iter: I) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = T&gt;,&nbsp;</span></code></h3><div class='docblock'><p>For use by <code>ToTokens</code> implementations.</p>
<pre><code class="language-edition2018"># use quote::{quote, TokenStreamExt, ToTokens};
# use proc_macro2::TokenStream;
#
struct X;
impl ToTokens for X {
fn to_tokens(&amp;self, tokens: &amp;mut TokenStream) {
tokens.append_all(&amp;[true, false]);
}
}
let tokens = quote!(#X);
assert_eq!(tokens.to_string(), &quot;true false&quot;);
</code></pre>
</div><h3 id='tymethod.append_separated' class='method'><code id='append_separated.v'>fn <a href='#tymethod.append_separated' class='fnname'>append_separated</a>&lt;T, I, U&gt;(&amp;mut self, iter: I, op: U) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = T&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,&nbsp;</span></code></h3><div class='docblock'><p>For use by <code>ToTokens</code> implementations.</p>
<p>Appends all of the items in the iterator <code>I</code>, separated by the tokens
<code>U</code>.</p>
</div><h3 id='tymethod.append_terminated' class='method'><code id='append_terminated.v'>fn <a href='#tymethod.append_terminated' class='fnname'>append_terminated</a>&lt;T, I, U&gt;(&amp;mut self, iter: I, term: U) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = T&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,&nbsp;</span></code></h3><div class='docblock'><p>For use by <code>ToTokens</code> implementations.</p>
<p>Appends all tokens in the iterator <code>I</code>, appending <code>U</code> after each
element, including after the last element of the iterator.</p>
</div></div><span class='loading-content'>Loading content...</span>
<h2 id='foreign-impls' class='small-section-header'>Implementations on Foreign Types<a href='#foreign-impls' class='anchor'></a></h2><h3 id='impl-TokenStreamExt-for-TokenStream' class='impl'><code class='in-band'>impl <a class="trait" href="../quote/trait.TokenStreamExt.html" title="trait quote::TokenStreamExt">TokenStreamExt</a> for <a class="struct" href="../proc_macro2/struct.TokenStream.html" title="struct proc_macro2::TokenStream">TokenStream</a></code><a href='#impl-TokenStreamExt-for-TokenStream' class='anchor'></a><a class='srclink' href='../src/quote/ext.rs.html#61-104' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.append' class="method hidden"><code id='append.v-1'>fn <a href='#method.append' class='fnname'>append</a>&lt;U&gt;(&amp;mut self, token: U) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="../proc_macro2/enum.TokenTree.html" title="enum proc_macro2::TokenTree">TokenTree</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/quote/ext.rs.html#62-67' title='goto source code'>[src]</a></h4><h4 id='method.append_all' class="method hidden"><code id='append_all.v-1'>fn <a href='#method.append_all' class='fnname'>append_all</a>&lt;T, I&gt;(&amp;mut self, iter: I) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = T&gt;,&nbsp;</span></code><a class='srclink' href='../src/quote/ext.rs.html#69-77' title='goto source code'>[src]</a></h4><h4 id='method.append_separated' class="method hidden"><code id='append_separated.v-1'>fn <a href='#method.append_separated' class='fnname'>append_separated</a>&lt;T, I, U&gt;(&amp;mut self, iter: I, op: U) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = T&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,&nbsp;</span></code><a class='srclink' href='../src/quote/ext.rs.html#79-91' title='goto source code'>[src]</a></h4><h4 id='method.append_terminated' class="method hidden"><code id='append_terminated.v-1'>fn <a href='#method.append_terminated' class='fnname'>append_terminated</a>&lt;T, I, U&gt;(&amp;mut self, iter: I, term: U) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = T&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,&nbsp;</span></code><a class='srclink' href='../src/quote/ext.rs.html#93-103' title='goto source code'>[src]</a></h4></div><span class='loading-content'>Loading content...</span>
<h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'></div><span class='loading-content'>Loading content...</span><script type="text/javascript">window.inlined_types=new Set([]);</script><script type="text/javascript" async
src="../implementors/quote/trait.TokenStreamExt.js">
</script></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "quote";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>