Add generated documentation

This commit is contained in:
2021-01-08 20:01:01 +01:00
parent a379a140d8
commit b89c52748d
10531 changed files with 270352 additions and 0 deletions

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

@@ -0,0 +1,6 @@
<!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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings"></script><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../favicon.svg">
<link rel="alternate icon" type="image/png" href="../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><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 rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><p class="location">Crate quote</p><div class="block version"><p>Version 1.0.8</p></div><a id="all-types" href="index.html"><p>Back to index</p></a></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><span class="help-button">?</span>
<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.IdentFragment.html">IdentFragment</a></li><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.format_ident.html">format_ident</a></li><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><script>window.rootPath = "../";window.currentCrate = "quote";</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>

View File

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

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

@@ -0,0 +1,65 @@
<!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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings"></script><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../favicon.svg">
<link rel="alternate icon" type="image/png" href="../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><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 rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><p class="location">Crate quote</p><div class="block version"><p>Version 1.0.8</p></div><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!" aria-haspopup="menu"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><span class="help-button">?</span>
<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-1262" title="goto source code">[src]</a></span><span class="in-band">Crate <a class="mod" href="">quote</a></span></h1><div class="docblock"><p><a href="https://github.com/dtolnay/quote"><img src="https://img.shields.io/badge/github-8da0cb?style=for-the-badge&amp;labelColor=555555&amp;logo=github" alt="github" /></a><a href="https://crates.io/crates/quote"><img src="https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&amp;labelColor=555555&amp;logo=rust" alt="crates-io" /></a><a href="https://docs.rs/quote"><img src="https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge&amp;labelColor=555555&amp;logoColor=white&amp;logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K" alt="docs-rs" /></a></p>
<br>
<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>
<pre><code class="language-toml">[dependencies]
quote = &quot;1.0&quot;
</code></pre>
<br>
<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>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<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="kw">struct</span> <span class="ident">SerializeWith</span> #<span class="ident">generics</span> #<span class="ident">where_clause</span> {
<span class="ident">value</span>: <span class="kw-2">&amp;</span><span class="lifetime">&#39;a</span> #<span class="ident">field_ty</span>,
<span class="ident">phantom</span>: <span class="ident">core</span>::<span class="ident">marker</span>::<span class="ident">PhantomData</span><span class="op">&lt;</span>#<span class="ident">item_ty</span><span class="op">&gt;</span>,
}
<span class="kw">impl</span> #<span class="ident">generics</span> <span class="ident">serde</span>::<span class="ident">Serialize</span> <span class="kw">for</span> <span class="ident">SerializeWith</span> #<span class="ident">generics</span> #<span class="ident">where_clause</span> {
<span class="kw">fn</span> <span class="ident">serialize</span><span class="op">&lt;</span><span class="ident">S</span><span class="op">&gt;</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">serializer</span>: <span class="ident">S</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="ident">S</span>::<span class="prelude-val">Ok</span>, <span class="ident">S</span>::<span class="ident">Error</span><span class="op">&gt;</span>
<span class="kw">where</span>
<span class="ident">S</span>: <span class="ident">serde</span>::<span class="ident">Serializer</span>,
{
#<span class="ident">path</span>(<span class="self">self</span>.<span class="ident">value</span>, <span class="ident">serializer</span>)
}
}
<span class="ident">SerializeWith</span> {
<span class="ident">value</span>: #<span class="ident">value</span>,
<span class="ident">phantom</span>: <span class="ident">core</span>::<span class="ident">marker</span>::<span class="ident">PhantomData</span>::<span class="op">&lt;</span>#<span class="ident">item_ty</span><span class="op">&gt;</span>,
}
};</pre></div>
</div><h2 id="macros" class="section-header"><a href="#macros">Macros</a></h2>
<table><tr class="module-item"><td><a class="macro" href="macro.format_ident.html" title="quote::format_ident macro">format_ident</a></td><td class="docblock-short"><p>Formatting macro for constructing <code>Ident</code>s.</p>
</td></tr><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.IdentFragment.html" title="quote::IdentFragment trait">IdentFragment</a></td><td class="docblock-short"><p>Specialized formatting trait used by <code>format_ident!</code>.</p>
</td></tr><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 <code>quote!</code> 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><script>window.rootPath = "../";window.currentCrate = "quote";</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.format_ident.html">
</head>
<body>
<p>Redirecting to <a href="macro.format_ident.html">macro.format_ident.html</a>...</p>
<script>location.replace("macro.format_ident.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,85 @@
<!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 `format_ident` macro in crate `quote`."><meta name="keywords" content="rust, rustlang, rust-lang, format_ident"><title>quote::format_ident - 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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings"></script><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../favicon.svg">
<link rel="alternate icon" type="image/png" href="../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><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 rust-logo'><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: "format_ident", 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!" aria-haspopup="menu"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><span class="help-button">?</span>
<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/format.rs.html#110-124" title="goto source code">[src]</a></span><span class="in-band">Macro <a href="index.html">quote</a>::<wbr><a class="macro" href="">format_ident</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">format_ident</span> {
(<span class="macro-nonterminal">$</span><span class="macro-nonterminal">fmt</span>:<span class="ident">expr</span>) <span class="op">=</span><span class="op">&gt;</span> { ... };
(<span class="macro-nonterminal">$</span><span class="macro-nonterminal">fmt</span>:<span class="ident">expr</span>, $(<span class="macro-nonterminal">$</span><span class="macro-nonterminal">rest</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>Formatting macro for constructing <code>Ident</code>s.</p>
<br>
<h1 id="syntax" class="section-header"><a href="#syntax">Syntax</a></h1>
<p>Syntax is copied from the <a href="https://doc.rust-lang.org/nightly/alloc/macro.format.html" title="format!"><code>format!</code></a> macro, supporting both positional and
named arguments.</p>
<p>Only a limited set of formatting traits are supported. The current mapping
of format types to traits is:</p>
<ul>
<li><code>{}</code> ⇒ [<code>IdentFragment</code>]</li>
<li><code>{:o}</code><a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Octal.html"><code>Octal</code></a></li>
<li><code>{:x}</code><a href="https://doc.rust-lang.org/nightly/core/fmt/trait.LowerHex.html"><code>LowerHex</code></a></li>
<li><code>{:X}</code><a href="https://doc.rust-lang.org/nightly/core/fmt/trait.UpperHex.html"><code>UpperHex</code></a></li>
<li><code>{:b}</code><a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Binary.html"><code>Binary</code></a></li>
</ul>
<p>See <a href="https://doc.rust-lang.org/nightly/alloc/fmt/index.html" title="std::fmt"><code>std::fmt</code></a> for more information.</p>
<br>
<h1 id="identfragment" class="section-header"><a href="#identfragment">IdentFragment</a></h1>
<p>Unlike <code>format!</code>, this macro uses the [<code>IdentFragment</code>] formatting trait by
default. This trait is like <code>Display</code>, with a few differences:</p>
<ul>
<li><code>IdentFragment</code> is only implemented for a limited set of types, such as
unsigned integers and strings.</li>
<li><a href="../proc_macro2/struct.Ident.html"><code>Ident</code></a> arguments will have their <code>r#</code> prefixes stripped, if present.</li>
</ul>
<br>
<h1 id="hygiene" class="section-header"><a href="#hygiene">Hygiene</a></h1>
<p>The <a href="../proc_macro2/struct.Span.html"><code>Span</code></a> of the first <code>Ident</code> argument is used as the span of the final
identifier, falling back to <a href="../proc_macro2/struct.Span.html#method.call_site"><code>Span::call_site</code></a> when no identifiers are
provided.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="comment">// If `ident` is an Ident, the span of `my_ident` will be inherited from it.</span>
<span class="kw">let</span> <span class="ident">my_ident</span> <span class="op">=</span> <span class="macro">format_ident</span><span class="macro">!</span>(<span class="string">&quot;My{}{}&quot;</span>, <span class="ident">ident</span>, <span class="string">&quot;IsCool&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">my_ident</span>, <span class="string">&quot;MyIdentIsCool&quot;</span>);</pre></div>
<p>Alternatively, the span can be overridden by passing the <code>span</code> named
argument.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">my_span</span> <span class="op">=</span> <span class="comment">/* ... */</span>;
<span class="macro">format_ident</span><span class="macro">!</span>(<span class="string">&quot;MyIdent&quot;</span>, <span class="ident">span</span> <span class="op">=</span> <span class="ident">my_span</span>);</pre></div>
<p><br></p>
<h1 id="panics" class="section-header"><a href="#panics">Panics</a></h1>
<p>This method will panic if the resulting formatted string is not a valid
identifier.</p>
<br>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
<p>Composing raw and non-raw identifiers:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">my_ident</span> <span class="op">=</span> <span class="macro">format_ident</span><span class="macro">!</span>(<span class="string">&quot;My{}&quot;</span>, <span class="string">&quot;Ident&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">my_ident</span>, <span class="string">&quot;MyIdent&quot;</span>);
<span class="kw">let</span> <span class="ident">raw</span> <span class="op">=</span> <span class="macro">format_ident</span><span class="macro">!</span>(<span class="string">&quot;r#Raw&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">raw</span>, <span class="string">&quot;r#Raw&quot;</span>);
<span class="kw">let</span> <span class="ident">my_ident_raw</span> <span class="op">=</span> <span class="macro">format_ident</span><span class="macro">!</span>(<span class="string">&quot;{}Is{}&quot;</span>, <span class="ident">my_ident</span>, <span class="ident">raw</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">my_ident_raw</span>, <span class="string">&quot;MyIdentIsRaw&quot;</span>);</pre></div>
<p>Integer formatting options:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">num</span>: <span class="ident">u32</span> <span class="op">=</span> <span class="number">10</span>;
<span class="kw">let</span> <span class="ident">decimal</span> <span class="op">=</span> <span class="macro">format_ident</span><span class="macro">!</span>(<span class="string">&quot;Id_{}&quot;</span>, <span class="ident">num</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">decimal</span>, <span class="string">&quot;Id_10&quot;</span>);
<span class="kw">let</span> <span class="ident">octal</span> <span class="op">=</span> <span class="macro">format_ident</span><span class="macro">!</span>(<span class="string">&quot;Id_{:o}&quot;</span>, <span class="ident">num</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">octal</span>, <span class="string">&quot;Id_12&quot;</span>);
<span class="kw">let</span> <span class="ident">binary</span> <span class="op">=</span> <span class="macro">format_ident</span><span class="macro">!</span>(<span class="string">&quot;Id_{:b}&quot;</span>, <span class="ident">num</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">binary</span>, <span class="string">&quot;Id_1010&quot;</span>);
<span class="kw">let</span> <span class="ident">lower_hex</span> <span class="op">=</span> <span class="macro">format_ident</span><span class="macro">!</span>(<span class="string">&quot;Id_{:x}&quot;</span>, <span class="ident">num</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">lower_hex</span>, <span class="string">&quot;Id_a&quot;</span>);
<span class="kw">let</span> <span class="ident">upper_hex</span> <span class="op">=</span> <span class="macro">format_ident</span><span class="macro">!</span>(<span class="string">&quot;Id_{:X}&quot;</span>, <span class="ident">num</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">upper_hex</span>, <span class="string">&quot;Id_A&quot;</span>);</pre></div>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "quote";</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>

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

@@ -0,0 +1,214 @@
<!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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings"></script><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../favicon.svg">
<link rel="alternate icon" type="image/png" href="../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><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 rust-logo'><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!" aria-haspopup="menu"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><span class="help-button">?</span>
<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#473-482" 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="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>The whole point.</p>
<p>Performs variable interpolation against the input and produces it as
<a href="../proc_macro2/struct.TokenStream.html" title="proc_macro2::TokenStream"><code>proc_macro2::TokenStream</code></a>.</p>
<p>Note: for returning tokens to the compiler in a procedural macro, use
<code>.into()</code> on the result to convert to <a href="https://doc.rust-lang.org/nightly/proc_macro/struct.TokenStream.html" title="proc_macro::TokenStream"><code>proc_macro::TokenStream</code></a>.</p>
<br>
<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 a <code>Vec</code>, slice,
<code>BTreeSet</code>, or any <code>Iterator</code>.</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>
<br>
<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/1.0/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>
<br>
<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>
<br>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1><h3 id="procedural-macro" class="section-header"><a href="#procedural-macro">Procedural macro</a></h3>
<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>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">proc_macro</span>;
<span class="kw">use</span> <span class="ident">proc_macro</span>::<span class="ident">TokenStream</span>;
<span class="kw">use</span> <span class="ident">quote</span>::<span class="ident">quote</span>;
<span class="attribute">#[<span class="ident">proc_macro_derive</span>(<span class="ident">HeapSize</span>)]</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">derive_heap_size</span>(<span class="ident">input</span>: <span class="ident">TokenStream</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">TokenStream</span> {
<span class="comment">// Parse the input and figure out what implementation to generate...</span>
<span class="kw">let</span> <span class="ident">name</span> <span class="op">=</span> <span class="comment">/* ... */</span>;
<span class="kw">let</span> <span class="ident">expr</span> <span class="op">=</span> <span class="comment">/* ... */</span>;
<span class="kw">let</span> <span class="ident">expanded</span> <span class="op">=</span> <span class="macro">quote</span><span class="macro">!</span> {
<span class="comment">// The generated impl.</span>
<span class="kw">impl</span> <span class="ident">heapsize</span>::<span class="ident">HeapSize</span> <span class="kw">for</span> #<span class="ident">name</span> {
<span class="kw">fn</span> <span class="ident">heap_size_of_children</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">usize</span> {
#<span class="ident">expr</span>
}
}
};
<span class="comment">// Hand the output tokens back to the compiler.</span>
<span class="ident">TokenStream</span>::<span class="ident">from</span>(<span class="ident">expanded</span>)
}</pre></div>
<p><br></p>
<h3 id="combining-quoted-fragments" class="section-header"><a href="#combining-quoted-fragments">Combining quoted fragments</a></h3>
<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>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">type_definition</span> <span class="op">=</span> <span class="macro">quote</span><span class="macro">!</span> {...};
<span class="kw">let</span> <span class="ident">methods</span> <span class="op">=</span> <span class="macro">quote</span><span class="macro">!</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">type_definition</span>
#<span class="ident">methods</span>
};</pre></div>
<p><br></p>
<h3 id="constructing-identifiers" class="section-header"><a href="#constructing-identifiers">Constructing identifiers</a></h3>
<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>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="comment">// incorrect</span>
<span class="macro">quote</span><span class="macro">!</span> {
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="kw">_</span>#<span class="ident">ident</span> <span class="op">=</span> <span class="number">0</span>;
}</pre></div>
<p>The solution is to build a new identifier token with the correct value. As
this is such a common case, the <a href="../quote/macro.format_ident.html" title="format_ident!"><code>format_ident!</code></a> macro provides a
convenient utility for doing so correctly.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">varname</span> <span class="op">=</span> <span class="macro">format_ident</span><span class="macro">!</span>(<span class="string">&quot;_{}&quot;</span>, <span class="ident">ident</span>);
<span class="macro">quote</span><span class="macro">!</span> {
<span class="kw">let</span> <span class="kw-2">mut</span> #<span class="ident">varname</span> <span class="op">=</span> <span class="number">0</span>;
}</pre></div>
<p>Alternatively, the APIs provided by Syn and proc-macro2 can be used to
directly build the identifier. This is roughly equivalent to the above, but
will not handle <code>ident</code> being a raw identifier.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">concatenated</span> <span class="op">=</span> <span class="macro">format</span><span class="macro">!</span>(<span class="string">&quot;_{}&quot;</span>, <span class="ident">ident</span>);
<span class="kw">let</span> <span class="ident">varname</span> <span class="op">=</span> <span class="ident">syn</span>::<span class="ident">Ident</span>::<span class="ident">new</span>(<span class="kw-2">&amp;</span><span class="ident">concatenated</span>, <span class="ident">ident</span>.<span class="ident">span</span>());
<span class="macro">quote</span><span class="macro">!</span> {
<span class="kw">let</span> <span class="kw-2">mut</span> #<span class="ident">varname</span> <span class="op">=</span> <span class="number">0</span>;
}</pre></div>
<p><br></p>
<h3 id="making-method-calls" class="section-header"><a href="#making-method-calls">Making method calls</a></h3>
<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>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="comment">// incorrect</span>
<span class="macro">quote</span><span class="macro">!</span> {
<span class="kw">let</span> <span class="ident">value</span> <span class="op">=</span> #<span class="ident">field_type</span>::<span class="ident">new</span>();
}</pre></div>
<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>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="macro">quote</span><span class="macro">!</span> {
<span class="kw">let</span> <span class="ident">value</span> <span class="op">=</span> <span class="op">&lt;</span>#<span class="ident">field_type</span><span class="op">&gt;</span>::<span class="ident">new</span>();
}</pre></div>
<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>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="macro">quote</span><span class="macro">!</span> {
<span class="kw">let</span> <span class="ident">value</span> <span class="op">=</span> <span class="op">&lt;</span>#<span class="ident">field_type</span> <span class="kw">as</span> <span class="ident">core</span>::<span class="ident">default</span>::<span class="ident">Default</span><span class="op">&gt;</span>::<span class="ident">default</span>();
}</pre></div>
<p><br></p>
<h3 id="interpolating-text-inside-of-doc-comments" class="section-header"><a href="#interpolating-text-inside-of-doc-comments">Interpolating text inside of doc comments</a></h3>
<p>Neither doc comments nor string literals get interpolation behavior in
quote:</p>
<div class='information'><div class='tooltip compile_fail'><span class='tooltiptext'>This example deliberately fails to compile</span></div></div><div class="example-wrap"><pre class="rust rust-example-rendered compile_fail">
<span class="macro">quote</span><span class="macro">!</span> {
<span class="doccomment">/// try to interpolate: #ident</span>
<span class="doccomment">///</span>
<span class="doccomment">/// ...</span>
}</pre></div>
<div class='information'><div class='tooltip compile_fail'><span class='tooltiptext'>This example deliberately fails to compile</span></div></div><div class="example-wrap"><pre class="rust rust-example-rendered compile_fail">
<span class="macro">quote</span><span class="macro">!</span> {
<span class="attribute">#[<span class="ident">doc</span> <span class="op">=</span> <span class="string">&quot;try to interpolate: #ident&quot;</span>]</span>
}</pre></div>
<p>Macro calls in a doc attribute are not valid syntax:</p>
<div class='information'><div class='tooltip compile_fail'><span class='tooltiptext'>This example deliberately fails to compile</span></div></div><div class="example-wrap"><pre class="rust rust-example-rendered compile_fail">
<span class="macro">quote</span><span class="macro">!</span> {
<span class="attribute">#[<span class="ident">doc</span> <span class="op">=</span> <span class="macro">concat</span><span class="macro">!</span>(<span class="string">&quot;try to interpolate: &quot;</span>, <span class="macro">stringify</span><span class="macro">!</span>(#<span class="ident">ident</span>))]</span>
}</pre></div>
<p>Instead the best way to build doc comments that involve variables is by
formatting the doc string literal outside of quote.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">msg</span> <span class="op">=</span> <span class="macro">format</span><span class="macro">!</span>(...);
<span class="macro">quote</span><span class="macro">!</span> {
<span class="attribute">#[<span class="ident">doc</span> <span class="op">=</span> #<span class="ident">msg</span>]</span>
<span class="doccomment">///</span>
<span class="doccomment">/// ...</span>
}</pre></div>
<p><br></p>
<h3 id="indexing-into-a-tuple-struct" class="section-header"><a href="#indexing-into-a-tuple-struct">Indexing into a tuple struct</a></h3>
<p>When interpolating indices of a tuple or tuple struct, we need them not to
appears suffixed as integer literals by interpolating them as <a href="https://docs.rs/syn/1.0/syn/struct.Index.html"><code>syn::Index</code></a>
instead.</p>
<div class='information'><div class='tooltip compile_fail'><span class='tooltiptext'>This example deliberately fails to compile</span></div></div><div class="example-wrap"><pre class="rust rust-example-rendered compile_fail">
<span class="kw">let</span> <span class="ident">i</span> <span class="op">=</span> <span class="number">0usize</span>..<span class="self">self</span>.<span class="ident">fields</span>.<span class="ident">len</span>();
<span class="comment">// expands to 0 + self.0usize.heap_size() + self.1usize.heap_size() + ...</span>
<span class="comment">// which is not valid syntax</span>
<span class="macro">quote</span><span class="macro">!</span> {
<span class="number">0</span> #( <span class="op">+</span> <span class="self">self</span>.#<span class="ident">i</span>.<span class="ident">heap_size</span>() )<span class="op">*</span>
}</pre></div>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">i</span> <span class="op">=</span> (<span class="number">0</span>..<span class="self">self</span>.<span class="ident">fields</span>.<span class="ident">len</span>()).<span class="ident">map</span>(<span class="ident">syn</span>::<span class="ident">Index</span>::<span class="ident">from</span>);
<span class="comment">// expands to 0 + self.0.heap_size() + self.1.heap_size() + ...</span>
<span class="macro">quote</span><span class="macro">!</span> {
<span class="number">0</span> #( <span class="op">+</span> <span class="self">self</span>.#<span class="ident">i</span>.<span class="ident">heap_size</span>() )<span class="op">*</span>
}</pre></div>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "quote";</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,60 @@
<!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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings"></script><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../favicon.svg">
<link rel="alternate icon" type="image/png" href="../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><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 rust-logo'><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!" aria-haspopup="menu"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><span class="help-button">?</span>
<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#581-592" 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="op">=</span><span class="op">&gt;</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>
<br>
<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/1.0/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>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">span</span> <span class="op">=</span> <span class="comment">/* ... */</span>;
<span class="comment">// On one line, use parentheses.</span>
<span class="kw">let</span> <span class="ident">tokens</span> <span class="op">=</span> <span class="macro">quote_spanned</span><span class="macro">!</span>(<span class="ident">span</span><span class="op">=</span><span class="op">&gt;</span> <span class="ident">Box</span>::<span class="ident">into_raw</span>(<span class="ident">Box</span>::<span class="ident">new</span>(#<span class="ident">init</span>)));
<span class="comment">// On multiple lines, place the span at the top and use braces.</span>
<span class="kw">let</span> <span class="ident">tokens</span> <span class="op">=</span> <span class="macro">quote_spanned</span><span class="macro">!</span> {<span class="ident">span</span><span class="op">=</span><span class="op">&gt;</span>
<span class="ident">Box</span>::<span class="ident">into_raw</span>(<span class="ident">Box</span>::<span class="ident">new</span>(#<span class="ident">init</span>))
};</pre></div>
<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>
<br>
<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>
<br>
<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>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">ty_span</span> <span class="op">=</span> <span class="ident">ty</span>.<span class="ident">span</span>();
<span class="kw">let</span> <span class="ident">assert_sync</span> <span class="op">=</span> <span class="macro">quote_spanned</span><span class="macro">!</span> {<span class="ident">ty_span</span><span class="op">=</span><span class="op">&gt;</span>
<span class="kw">struct</span> <span class="ident">_AssertSync</span> <span class="kw">where</span> #<span class="ident">ty</span>: <span class="ident">Sync</span>;
};</pre></div>
<p>If the assertion fails, the user will see an error like the following. The
input span of their type is highlighted 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.</p>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "quote";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>

View File

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

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>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,32 @@
<!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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings"></script><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../favicon.svg">
<link rel="alternate icon" type="image/png" href="../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><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 rust-logo'><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!" aria-haspopup="menu"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><span class="help-button">?</span>
<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;I&gt;(&amp;mut self, iter: I)<br>&nbsp;&nbsp;&nbsp; <span class="where">where<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>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <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_separated" class="fnname">append_separated</a>&lt;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;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>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,<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;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;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>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,<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>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>fn <a href="#tymethod.append_all" class="fnname">append_all</a>&lt;I&gt;(&amp;mut self, iter: 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/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;I::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <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>
<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">TokenStream</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><h3 id="tymethod.append_separated" class="method"><code>fn <a href="#tymethod.append_separated" class="fnname">append_separated</a>&lt;I, U&gt;(&amp;mut self, iter: I, op: U) <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/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;I::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,<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>fn <a href="#tymethod.append_terminated" class="fnname">append_terminated</a>&lt;I, U&gt;(&amp;mut self, iter: I, term: U) <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/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;I::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,<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>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>fn <a href="#method.append_all" class="fnname">append_all</a>&lt;I&gt;(&amp;mut self, iter: 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/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;I::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <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#69-77" title="goto source code">[src]</a></h4><h4 id="method.append_separated" class="method hidden"><code>fn <a href="#method.append_separated" class="fnname">append_separated</a>&lt;I, U&gt;(&amp;mut self, iter: I, op: U) <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/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;I::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,<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>fn <a href="#method.append_terminated" class="fnname">append_terminated</a>&lt;I, U&gt;(&amp;mut self, iter: I, term: U) <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/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;I::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <a class="trait" href="../quote/trait.ToTokens.html" title="trait quote::ToTokens">ToTokens</a>,<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" src="../implementors/quote/trait.TokenStreamExt.js" async></script></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "quote";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>