Auto Generated Documentation
This commit is contained in:
+17
-17
@@ -1,40 +1,40 @@
|
||||
<!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="Tokens representing Rust punctuation, keywords, and delimiters."><meta name="keywords" content="rust, rustlang, rust-lang, token"><title>syn::token - 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><script src="../../crates.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" role="button">☰</div><a href='../../syn/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Module token</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li></ul></div><p class="location"><a href="../index.html">syn</a></p><div id="sidebar-vars" data-name="token" data-ty="mod" data-relpath="../"></div><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" height="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><button type="button" class="help-button">?</button>
|
||||
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../index.html">syn</a>::<wbr><a class="mod" href="">token</a></span><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">−</span>]</a></span><a class="srclink" href="../../src/syn/token.rs.html#1-1013" title="goto source code">[src]</a></span></h1><div class="docblock"><p>Tokens representing Rust punctuation, keywords, and delimiters.</p>
|
||||
<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 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../../syn/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Module token</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li></ul></div><p class="location"><a href="../index.html">syn</a></p><div id="sidebar-vars" data-name="token" data-ty="mod" data-relpath="../"></div><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" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><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><button type="button" class="help-button">?</button>
|
||||
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../index.html">syn</a>::<wbr><a class="mod" href="">token</a><button id="copy-path" onclick="copy_path(this)">⎘</button></span><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">−</span>]</a></span><a class="srclink" href="../../src/syn/token.rs.html#1-1013" title="goto source code">[src]</a></span></h1><div class="docblock"><p>Tokens representing Rust punctuation, keywords, and delimiters.</p>
|
||||
<p>The type names in this module can be difficult to keep straight, so we
|
||||
prefer to use the <a href="../../syn/macro.Token.html"><code>Token!</code></a> macro instead. This is a type-macro that
|
||||
prefer to use the <a href="../macro.Token.html"><code>Token!</code></a> macro instead. This is a type-macro that
|
||||
expands to the token type of the given token.</p>
|
||||
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
|
||||
<p>The <a href="../../syn/struct.ItemStatic.html"><code>ItemStatic</code></a> syntax tree node is defined like this.</p>
|
||||
<p>The <a href="../struct.ItemStatic.html"><code>ItemStatic</code></a> syntax tree node is defined like this.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">ItemStatic</span> {
|
||||
<span class="kw">pub</span> <span class="ident">attrs</span>: <span class="ident">Vec</span><span class="op"><</span><span class="ident">Attribute</span><span class="op">></span>,
|
||||
<span class="kw">pub</span> <span class="ident">vis</span>: <span class="ident">Visibility</span>,
|
||||
<span class="kw">pub</span> <span class="ident">static_token</span>: <span class="macro">Token</span><span class="macro">!</span>[<span class="kw">static</span>],
|
||||
<span class="kw">pub</span> <span class="ident">mutability</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="macro">Token</span><span class="macro">!</span>[<span class="kw-2">mut</span>]<span class="op">></span>,
|
||||
<span class="kw">pub</span> <span class="ident">static_token</span>: <span class="macro">Token!</span>[<span class="kw">static</span>],
|
||||
<span class="kw">pub</span> <span class="ident">mutability</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="macro">Token!</span>[<span class="kw-2">mut</span>]<span class="op">></span>,
|
||||
<span class="kw">pub</span> <span class="ident">ident</span>: <span class="ident">Ident</span>,
|
||||
<span class="kw">pub</span> <span class="ident">colon_token</span>: <span class="macro">Token</span><span class="macro">!</span>[:],
|
||||
<span class="kw">pub</span> <span class="ident">colon_token</span>: <span class="macro">Token!</span>[:],
|
||||
<span class="kw">pub</span> <span class="ident">ty</span>: <span class="ident">Box</span><span class="op"><</span><span class="ident">Type</span><span class="op">></span>,
|
||||
<span class="kw">pub</span> <span class="ident">eq_token</span>: <span class="macro">Token</span><span class="macro">!</span>[<span class="op">=</span>],
|
||||
<span class="kw">pub</span> <span class="ident">eq_token</span>: <span class="macro">Token!</span>[<span class="op">=</span>],
|
||||
<span class="kw">pub</span> <span class="ident">expr</span>: <span class="ident">Box</span><span class="op"><</span><span class="ident">Expr</span><span class="op">></span>,
|
||||
<span class="kw">pub</span> <span class="ident">semi_token</span>: <span class="macro">Token</span><span class="macro">!</span>[;],
|
||||
<span class="kw">pub</span> <span class="ident">semi_token</span>: <span class="macro">Token!</span>[;],
|
||||
}</pre></div>
|
||||
<h1 id="parsing" class="section-header"><a href="#parsing">Parsing</a></h1>
|
||||
<p>Keywords and punctuation can be parsed through the <a href="../../syn/parse/struct.ParseBuffer.html#method.parse"><code>ParseStream::parse</code></a>
|
||||
method. Delimiter tokens are parsed using the <a href="../../syn/macro.parenthesized.html"><code>parenthesized!</code></a>,
|
||||
<a href="../../syn/macro.bracketed.html"><code>bracketed!</code></a> and <a href="../../syn/macro.braced.html"><code>braced!</code></a> macros.</p>
|
||||
<p>Keywords and punctuation can be parsed through the <a href="../parse/struct.ParseBuffer.html#method.parse"><code>ParseStream::parse</code></a>
|
||||
method. Delimiter tokens are parsed using the <a href="../macro.parenthesized.html"><code>parenthesized!</code></a>,
|
||||
<a href="../macro.bracketed.html"><code>bracketed!</code></a> and <a href="../macro.braced.html"><code>braced!</code></a> macros.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">syn</span>::{<span class="ident">Attribute</span>, <span class="prelude-ty">Result</span>};
|
||||
<span class="kw">use</span> <span class="ident">syn</span>::<span class="ident">parse</span>::{<span class="ident">Parse</span>, <span class="ident">ParseStream</span>};
|
||||
<span class="kw">use</span> <span class="ident">syn::parse</span>::{<span class="ident">Parse</span>, <span class="ident">ParseStream</span>};
|
||||
|
||||
<span class="comment">// Parse the ItemStatic struct shown above.</span>
|
||||
<span class="kw">impl</span> <span class="ident">Parse</span> <span class="kw">for</span> <span class="ident">ItemStatic</span> {
|
||||
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">input</span>: <span class="ident">ParseStream</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span><span class="op">></span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">ItemStatic</span> {
|
||||
<span class="ident">attrs</span>: <span class="ident">input</span>.<span class="ident">call</span>(<span class="ident">Attribute</span>::<span class="ident">parse_outer</span>)<span class="question-mark">?</span>,
|
||||
<span class="ident">attrs</span>: <span class="ident">input</span>.<span class="ident">call</span>(<span class="ident">Attribute::parse_outer</span>)<span class="question-mark">?</span>,
|
||||
<span class="ident">vis</span>: <span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>,
|
||||
<span class="ident">static_token</span>: <span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>,
|
||||
<span class="ident">mutability</span>: <span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>,
|
||||
@@ -51,10 +51,10 @@ method. Delimiter tokens are parsed using the <a href="../../syn/macro.parenthes
|
||||
<p>Every keyword and punctuation token supports the following operations.</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p><a href="../../syn/parse/struct.ParseBuffer.html#method.peek">Peeking</a> — <code>input.peek(Token![...])</code></p>
|
||||
<p><a href="../parse/struct.ParseBuffer.html#method.peek">Peeking</a> — <code>input.peek(Token![...])</code></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="../../syn/parse/struct.ParseBuffer.html#method.parse">Parsing</a> — <code>input.parse::<Token![...]>()?</code></p>
|
||||
<p><a href="../parse/struct.ParseBuffer.html#method.parse">Parsing</a> — <code>input.parse::<Token![...]>()?</code></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="https://docs.rs/quote/1.0/quote/trait.ToTokens.html">Printing</a> — <code>quote!( ... #the_token ... )</code></p>
|
||||
@@ -172,5 +172,5 @@ method. Delimiter tokens are parsed using the <a href="../../syn/macro.parenthes
|
||||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Yield.html" title="syn::token::Yield struct">Yield</a></td><td class="docblock-short"><p><code>yield</code></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.Token.html" title="syn::token::Token trait">Token</a></td><td class="docblock-short"><p>Marker trait for types that represent single tokens.</p>
|
||||
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="syn" data-search-js="../../search-index.js"></div>
|
||||
</td></tr></table></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="syn" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
|
||||
<script src="../../main.js"></script></body></html>
|
||||
Reference in New Issue
Block a user