rusty_snek_gaem/target/doc/syn/parse/struct.ParseBuffer.html
2018-10-28 21:14:05 -05:00

416 lines
54 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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 `ParseBuffer` struct in crate `syn`."><meta name="keywords" content="rust, rustlang, rust-lang, ParseBuffer"><title>syn::parse::ParseBuffer - 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></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><p class='location'>Struct ParseBuffer</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.parse">parse</a><a href="#method.call">call</a><a href="#method.peek">peek</a><a href="#method.peek2">peek2</a><a href="#method.peek3">peek3</a><a href="#method.parse_terminated">parse_terminated</a><a href="#method.is_empty">is_empty</a><a href="#method.lookahead1">lookahead1</a><a href="#method.fork">fork</a><a href="#method.error">error</a><a href="#method.step">step</a><a href="#method.cursor">cursor</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Drop">Drop</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-Send">!Send</a><a href="#impl-Sync">!Sync</a></div></div><p class='location'><a href='../index.html'>syn</a>::<wbr><a href='index.html'>parse</a></p><script>window.sidebarCurrent = {name: 'ParseBuffer', 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"><input class="search-input" name="search" autocomplete="off" placeholder="Click or press S to search, ? for more options…" type="search"><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='in-band'>Struct <a href='../index.html'>syn</a>::<wbr><a href='index.html'>parse</a>::<wbr><a class="struct" href=''>ParseBuffer</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'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/syn/parse.rs.html#245-261' title='goto source code'>[src]</a></span></h1><div class="docblock type-decl"><pre class='rust struct'>pub struct ParseBuffer&lt;'a&gt; { /* fields omitted */ }</pre></div><div class='docblock'><p>Cursor position within a buffered token stream.</p>
<p>This type is more commonly used through the type alias [<code>ParseStream</code>] which
is an alias for <code>&amp;ParseBuffer</code>.</p>
<p><code>ParseStream</code> is the input type for all parser functions in Syn. They have
the signature <code>fn(ParseStream) -&gt; Result&lt;T&gt;</code>.</p>
</div><h2 id='methods' class='small-section-header'>Methods<a href='#methods' class='anchor'></a></h2><h3 id='impl' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;'a&gt; <a class="struct" href="../../syn/parse/struct.ParseBuffer.html" title="struct syn::parse::ParseBuffer">ParseBuffer</a>&lt;'a&gt;</code><a href='#impl' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/parse.rs.html#385-974' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.parse' class="method"><span id='parse.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.parse' class='fnname'>parse</a>&lt;T:&nbsp;<a class="trait" href="../../syn/parse/trait.Parse.html" title="trait syn::parse::Parse">Parse</a>&gt;(&amp;self) -&gt; <a class="type" href="../../syn/parse/type.Result.html" title="type syn::parse::Result">Result</a>&lt;T&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/parse.rs.html#388-390' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Parses a syntax tree node of type <code>T</code>, advancing the position of our
parse stream past it.</p>
</div><h4 id='method.call' class="method"><span id='call.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.call' class='fnname'>call</a>&lt;T&gt;(&amp;self, function: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.fn.html">fn</a>(_: <a class="type" href="../../syn/parse/type.ParseStream.html" title="type syn::parse::ParseStream">ParseStream</a>) -&gt; <a class="type" href="../../syn/parse/type.Result.html" title="type syn::parse::Result">Result</a>&lt;T&gt;) -&gt; <a class="type" href="../../syn/parse/type.Result.html" title="type syn::parse::Result">Result</a>&lt;T&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/parse.rs.html#433-435' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Calls the given parser function to parse a syntax tree node of type <code>T</code>
from this stream.</p>
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
<p>The parser below invokes <a href="../struct.Attribute.html#method.parse_outer"><code>Attribute::parse_outer</code></a> to parse a vector of
zero or more outer attributes.</p>
<pre class="rust rust-example-rendered">
<span class="attribute">#[<span class="ident">macro_use</span>]</span>
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">syn</span>;
<span class="kw">use</span> <span class="ident">syn</span>::{<span class="ident">Attribute</span>, <span class="ident">Ident</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="prelude-ty">Result</span>};
<span class="comment">// Parses a unit struct with attributes.</span>
<span class="comment">//</span>
<span class="comment">// #[path = &quot;s.tmpl&quot;]</span>
<span class="comment">// struct S;</span>
<span class="kw">struct</span> <span class="ident">UnitStruct</span> {
<span class="ident">attrs</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">Attribute</span><span class="op">&gt;</span>,
<span class="ident">struct_token</span>: <span class="macro">Token</span><span class="macro">!</span>[<span class="kw">struct</span>],
<span class="ident">name</span>: <span class="ident">Ident</span>,
<span class="ident">semi_token</span>: <span class="macro">Token</span><span class="macro">!</span>[;],
}
<span class="kw">impl</span> <span class="ident">Parse</span> <span class="kw">for</span> <span class="ident">UnitStruct</span> {
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">input</span>: <span class="ident">ParseStream</span>) <span class="op">-&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="self">Self</span><span class="op">&gt;</span> {
<span class="prelude-val">Ok</span>(<span class="ident">UnitStruct</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">struct_token</span>: <span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>,
<span class="ident">name</span>: <span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>,
<span class="ident">semi_token</span>: <span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>,
})
}
}</pre>
</div><h4 id='method.peek' class="method"><span id='peek.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.peek' class='fnname'>peek</a>&lt;T:&nbsp;<a class="trait" href="../../syn/parse/trait.Peek.html" title="trait syn::parse::Peek">Peek</a>&gt;(&amp;self, token: T) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/parse.rs.html#513-516' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Looks at the next token in the parse stream to determine whether it
matches the requested type of token.</p>
<p>Does not advance the position of the parse stream.</p>
<h1 id="syntax" class="section-header"><a href="#syntax">Syntax</a></h1>
<p>Note that this method does not use turbofish syntax. Pass the peek type
inside of parentheses.</p>
<ul>
<li><code>input.peek(Token![struct])</code></li>
<li><code>input.peek(Token![==])</code></li>
<li><code>input.peek(Ident)</code></li>
<li><code>input.peek(Lifetime)</code></li>
<li><code>input.peek(token::Brace)</code></li>
</ul>
<h1 id="example-1" class="section-header"><a href="#example-1">Example</a></h1>
<p>In this example we finish parsing the list of supertraits when the next
token in the input is either <code>where</code> or an opening curly brace.</p>
<pre class="rust rust-example-rendered">
<span class="attribute">#[<span class="ident">macro_use</span>]</span>
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">syn</span>;
<span class="kw">use</span> <span class="ident">syn</span>::{<span class="ident">token</span>, <span class="ident">Generics</span>, <span class="ident">Ident</span>, <span class="ident">TypeParamBound</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="prelude-ty">Result</span>};
<span class="kw">use</span> <span class="ident">syn</span>::<span class="ident">punctuated</span>::<span class="ident">Punctuated</span>;
<span class="comment">// Parses a trait definition containing no associated items.</span>
<span class="comment">//</span>
<span class="comment">// trait Marker&lt;&#39;de, T&gt;: A + B&lt;&#39;de&gt; where Box&lt;T&gt;: Clone {}</span>
<span class="kw">struct</span> <span class="ident">MarkerTrait</span> {
<span class="ident">trait_token</span>: <span class="macro">Token</span><span class="macro">!</span>[<span class="kw">trait</span>],
<span class="ident">ident</span>: <span class="ident">Ident</span>,
<span class="ident">generics</span>: <span class="ident">Generics</span>,
<span class="ident">colon_token</span>: <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="macro">Token</span><span class="macro">!</span>[:]<span class="op">&gt;</span>,
<span class="ident">supertraits</span>: <span class="ident">Punctuated</span><span class="op">&lt;</span><span class="ident">TypeParamBound</span>, <span class="macro">Token</span><span class="macro">!</span>[<span class="op">+</span>]<span class="op">&gt;</span>,
<span class="ident">brace_token</span>: <span class="ident">token</span>::<span class="ident">Brace</span>,
}
<span class="kw">impl</span> <span class="ident">Parse</span> <span class="kw">for</span> <span class="ident">MarkerTrait</span> {
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">input</span>: <span class="ident">ParseStream</span>) <span class="op">-&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="self">Self</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">trait_token</span>: <span class="macro">Token</span><span class="macro">!</span>[<span class="kw">trait</span>] <span class="op">=</span> <span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>;
<span class="kw">let</span> <span class="ident">ident</span>: <span class="ident">Ident</span> <span class="op">=</span> <span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">generics</span>: <span class="ident">Generics</span> <span class="op">=</span> <span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>;
<span class="kw">let</span> <span class="ident">colon_token</span>: <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="macro">Token</span><span class="macro">!</span>[:]<span class="op">&gt;</span> <span class="op">=</span> <span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">supertraits</span> <span class="op">=</span> <span class="ident">Punctuated</span>::<span class="ident">new</span>();
<span class="kw">if</span> <span class="ident">colon_token</span>.<span class="ident">is_some</span>() {
<span class="kw">loop</span> {
<span class="ident">supertraits</span>.<span class="ident">push_value</span>(<span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>);
<span class="kw">if</span> <span class="ident">input</span>.<span class="ident">peek</span>(<span class="macro">Token</span><span class="macro">!</span>[<span class="kw">where</span>]) <span class="op">||</span> <span class="ident">input</span>.<span class="ident">peek</span>(<span class="ident">token</span>::<span class="ident">Brace</span>) {
<span class="kw">break</span>;
}
<span class="ident">supertraits</span>.<span class="ident">push_punct</span>(<span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>);
}
}
<span class="ident">generics</span>.<span class="ident">where_clause</span> <span class="op">=</span> <span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>;
<span class="kw">let</span> <span class="ident">content</span>;
<span class="kw">let</span> <span class="ident">empty_brace_token</span> <span class="op">=</span> <span class="macro">braced</span><span class="macro">!</span>(<span class="ident">content</span> <span class="kw">in</span> <span class="ident">input</span>);
<span class="prelude-val">Ok</span>(<span class="ident">MarkerTrait</span> {
<span class="ident">trait_token</span>: <span class="ident">trait_token</span>,
<span class="ident">ident</span>: <span class="ident">ident</span>,
<span class="ident">generics</span>: <span class="ident">generics</span>,
<span class="ident">colon_token</span>: <span class="ident">colon_token</span>,
<span class="ident">supertraits</span>: <span class="ident">supertraits</span>,
<span class="ident">brace_token</span>: <span class="ident">empty_brace_token</span>,
})
}
}</pre>
</div><h4 id='method.peek2' class="method"><span id='peek2.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.peek2' class='fnname'>peek2</a>&lt;T:&nbsp;<a class="trait" href="../../syn/parse/trait.Peek.html" title="trait syn::parse::Peek">Peek</a>&gt;(&amp;self, token: T) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/parse.rs.html#557-560' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Looks at the second-next token in the parse stream.</p>
<p>This is commonly useful as a way to implement contextual keywords.</p>
<h1 id="example-2" class="section-header"><a href="#example-2">Example</a></h1>
<p>This example needs to use <code>peek2</code> because the symbol <code>union</code> is not a
keyword in Rust. We can't use just <code>peek</code> and decide to parse a union if
the very next token is <code>union</code>, because someone is free to write a <code>mod union</code> and a macro invocation that looks like <code>union::some_macro! { ... }</code>. In other words <code>union</code> is a contextual keyword.</p>
<pre class="rust rust-example-rendered">
<span class="attribute">#[<span class="ident">macro_use</span>]</span>
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">syn</span>;
<span class="kw">use</span> <span class="ident">syn</span>::{<span class="ident">Ident</span>, <span class="ident">ItemUnion</span>, <span class="ident">Macro</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="prelude-ty">Result</span>};
<span class="comment">// Parses either a union or a macro invocation.</span>
<span class="kw">enum</span> <span class="ident">UnionOrMacro</span> {
<span class="comment">// union MaybeUninit&lt;T&gt; { uninit: (), value: T }</span>
<span class="ident">Union</span>(<span class="ident">ItemUnion</span>),
<span class="comment">// lazy_static! { ... }</span>
<span class="ident">Macro</span>(<span class="ident">Macro</span>),
}
<span class="kw">impl</span> <span class="ident">Parse</span> <span class="kw">for</span> <span class="ident">UnionOrMacro</span> {
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">input</span>: <span class="ident">ParseStream</span>) <span class="op">-&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="self">Self</span><span class="op">&gt;</span> {
<span class="kw">if</span> <span class="ident">input</span>.<span class="ident">peek</span>(<span class="macro">Token</span><span class="macro">!</span>[<span class="ident">union</span>]) <span class="op">&amp;&amp;</span> <span class="ident">input</span>.<span class="ident">peek2</span>(<span class="ident">Ident</span>) {
<span class="ident">input</span>.<span class="ident">parse</span>().<span class="ident">map</span>(<span class="ident">UnionOrMacro</span>::<span class="ident">Union</span>)
} <span class="kw">else</span> {
<span class="ident">input</span>.<span class="ident">parse</span>().<span class="ident">map</span>(<span class="ident">UnionOrMacro</span>::<span class="ident">Macro</span>)
}
}
}</pre>
</div><h4 id='method.peek3' class="method"><span id='peek3.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.peek3' class='fnname'>peek3</a>&lt;T:&nbsp;<a class="trait" href="../../syn/parse/trait.Peek.html" title="trait syn::parse::Peek">Peek</a>&gt;(&amp;self, token: T) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/parse.rs.html#563-566' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Looks at the third-next token in the parse stream.</p>
</div><h4 id='method.parse_terminated' class="method"><span id='parse_terminated.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.parse_terminated' class='fnname'>parse_terminated</a>&lt;T, P:&nbsp;<a class="trait" href="../../syn/parse/trait.Parse.html" title="trait syn::parse::Parse">Parse</a>&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;parser: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.fn.html">fn</a>(_: <a class="type" href="../../syn/parse/type.ParseStream.html" title="type syn::parse::ParseStream">ParseStream</a>) -&gt; <a class="type" href="../../syn/parse/type.Result.html" title="type syn::parse::Result">Result</a>&lt;T&gt;<br>) -&gt; <a class="type" href="../../syn/parse/type.Result.html" title="type syn::parse::Result">Result</a>&lt;<a class="struct" href="../../syn/punctuated/struct.Punctuated.html" title="struct syn::punctuated::Punctuated">Punctuated</a>&lt;T, P&gt;&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/parse.rs.html#618-623' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Parses zero or more occurrences of <code>T</code> separated by punctuation of type
<code>P</code>, with optional trailing punctuation.</p>
<p>Parsing continues until the end of this parse stream. The entire content
of this parse stream must consist of <code>T</code> and <code>P</code>.</p>
<h1 id="example-3" class="section-header"><a href="#example-3">Example</a></h1>
<pre class="rust rust-example-rendered">
<span class="attribute">#[<span class="ident">macro_use</span>]</span>
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">syn</span>;
<span class="kw">use</span> <span class="ident">syn</span>::{<span class="ident">token</span>, <span class="ident">Ident</span>, <span class="ident">Type</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="prelude-ty">Result</span>};
<span class="kw">use</span> <span class="ident">syn</span>::<span class="ident">punctuated</span>::<span class="ident">Punctuated</span>;
<span class="comment">// Parse a simplified tuple struct syntax like:</span>
<span class="comment">//</span>
<span class="comment">// struct S(A, B);</span>
<span class="kw">struct</span> <span class="ident">TupleStruct</span> {
<span class="ident">struct_token</span>: <span class="macro">Token</span><span class="macro">!</span>[<span class="kw">struct</span>],
<span class="ident">ident</span>: <span class="ident">Ident</span>,
<span class="ident">paren_token</span>: <span class="ident">token</span>::<span class="ident">Paren</span>,
<span class="ident">fields</span>: <span class="ident">Punctuated</span><span class="op">&lt;</span><span class="ident">Type</span>, <span class="macro">Token</span><span class="macro">!</span>[,]<span class="op">&gt;</span>,
<span class="ident">semi_token</span>: <span class="macro">Token</span><span class="macro">!</span>[;],
}
<span class="kw">impl</span> <span class="ident">Parse</span> <span class="kw">for</span> <span class="ident">TupleStruct</span> {
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">input</span>: <span class="ident">ParseStream</span>) <span class="op">-&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="self">Self</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">content</span>;
<span class="prelude-val">Ok</span>(<span class="ident">TupleStruct</span> {
<span class="ident">struct_token</span>: <span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>,
<span class="ident">ident</span>: <span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>,
<span class="ident">paren_token</span>: <span class="macro">parenthesized</span><span class="macro">!</span>(<span class="ident">content</span> <span class="kw">in</span> <span class="ident">input</span>),
<span class="ident">fields</span>: <span class="ident">content</span>.<span class="ident">parse_terminated</span>(<span class="ident">Type</span>::<span class="ident">parse</span>)<span class="question-mark">?</span>,
<span class="ident">semi_token</span>: <span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>,
})
}
}</pre>
</div><h4 id='method.is_empty' class="method"><span id='is_empty.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.is_empty' class='fnname'>is_empty</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/parse.rs.html#666-668' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Returns whether there are tokens remaining in this stream.</p>
<p>This method returns true at the end of the content of a set of
delimiters, as well as at the very end of the complete macro input.</p>
<h1 id="example-4" class="section-header"><a href="#example-4">Example</a></h1>
<pre class="rust rust-example-rendered">
<span class="attribute">#[<span class="ident">macro_use</span>]</span>
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">syn</span>;
<span class="kw">use</span> <span class="ident">syn</span>::{<span class="ident">token</span>, <span class="ident">Ident</span>, <span class="ident">Item</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="prelude-ty">Result</span>};
<span class="comment">// Parses a Rust `mod m { ... }` containing zero or more items.</span>
<span class="kw">struct</span> <span class="ident">Mod</span> {
<span class="ident">mod_token</span>: <span class="macro">Token</span><span class="macro">!</span>[<span class="kw">mod</span>],
<span class="ident">name</span>: <span class="ident">Ident</span>,
<span class="ident">brace_token</span>: <span class="ident">token</span>::<span class="ident">Brace</span>,
<span class="ident">items</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">Item</span><span class="op">&gt;</span>,
}
<span class="kw">impl</span> <span class="ident">Parse</span> <span class="kw">for</span> <span class="ident">Mod</span> {
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">input</span>: <span class="ident">ParseStream</span>) <span class="op">-&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="self">Self</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">content</span>;
<span class="prelude-val">Ok</span>(<span class="ident">Mod</span> {
<span class="ident">mod_token</span>: <span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>,
<span class="ident">name</span>: <span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>,
<span class="ident">brace_token</span>: <span class="macro">braced</span><span class="macro">!</span>(<span class="ident">content</span> <span class="kw">in</span> <span class="ident">input</span>),
<span class="ident">items</span>: {
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">items</span> <span class="op">=</span> <span class="ident">Vec</span>::<span class="ident">new</span>();
<span class="kw">while</span> <span class="op">!</span><span class="ident">content</span>.<span class="ident">is_empty</span>() {
<span class="ident">items</span>.<span class="ident">push</span>(<span class="ident">content</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>);
}
<span class="ident">items</span>
},
})
}
}</pre>
</div><h4 id='method.lookahead1' class="method"><span id='lookahead1.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.lookahead1' class='fnname'>lookahead1</a>(&amp;self) -&gt; <a class="struct" href="../../syn/parse/struct.Lookahead1.html" title="struct syn::parse::Lookahead1">Lookahead1</a>&lt;'a&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/parse.rs.html#716-718' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Constructs a helper for peeking at the next token in this stream and
building an error message if it is not one of a set of expected tokens.</p>
<h1 id="example-5" class="section-header"><a href="#example-5">Example</a></h1>
<pre class="rust rust-example-rendered">
<span class="attribute">#[<span class="ident">macro_use</span>]</span>
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">syn</span>;
<span class="kw">use</span> <span class="ident">syn</span>::{<span class="ident">ConstParam</span>, <span class="ident">Ident</span>, <span class="ident">Lifetime</span>, <span class="ident">LifetimeDef</span>, <span class="ident">TypeParam</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="prelude-ty">Result</span>};
<span class="comment">// A generic parameter, a single one of the comma-separated elements inside</span>
<span class="comment">// angle brackets in:</span>
<span class="comment">//</span>
<span class="comment">// fn f&lt;T: Clone, &#39;a, &#39;b: &#39;a, const N: usize&gt;() { ... }</span>
<span class="comment">//</span>
<span class="comment">// On invalid input, lookahead gives us a reasonable error message.</span>
<span class="comment">//</span>
<span class="comment">// error: expected one of: identifier, lifetime, `const`</span>
<span class="comment">// |</span>
<span class="comment">// 5 | fn f&lt;!Sized&gt;() {}</span>
<span class="comment">// | ^</span>
<span class="kw">enum</span> <span class="ident">GenericParam</span> {
<span class="ident">Type</span>(<span class="ident">TypeParam</span>),
<span class="ident">Lifetime</span>(<span class="ident">LifetimeDef</span>),
<span class="ident">Const</span>(<span class="ident">ConstParam</span>),
}
<span class="kw">impl</span> <span class="ident">Parse</span> <span class="kw">for</span> <span class="ident">GenericParam</span> {
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">input</span>: <span class="ident">ParseStream</span>) <span class="op">-&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="self">Self</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">lookahead</span> <span class="op">=</span> <span class="ident">input</span>.<span class="ident">lookahead1</span>();
<span class="kw">if</span> <span class="ident">lookahead</span>.<span class="ident">peek</span>(<span class="ident">Ident</span>) {
<span class="ident">input</span>.<span class="ident">parse</span>().<span class="ident">map</span>(<span class="ident">GenericParam</span>::<span class="ident">Type</span>)
} <span class="kw">else</span> <span class="kw">if</span> <span class="ident">lookahead</span>.<span class="ident">peek</span>(<span class="ident">Lifetime</span>) {
<span class="ident">input</span>.<span class="ident">parse</span>().<span class="ident">map</span>(<span class="ident">GenericParam</span>::<span class="ident">Lifetime</span>)
} <span class="kw">else</span> <span class="kw">if</span> <span class="ident">lookahead</span>.<span class="ident">peek</span>(<span class="macro">Token</span><span class="macro">!</span>[<span class="kw">const</span>]) {
<span class="ident">input</span>.<span class="ident">parse</span>().<span class="ident">map</span>(<span class="ident">GenericParam</span>::<span class="ident">Const</span>)
} <span class="kw">else</span> {
<span class="prelude-val">Err</span>(<span class="ident">lookahead</span>.<span class="ident">error</span>())
}
}
}</pre>
</div><h4 id='method.fork' class="method"><span id='fork.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.fork' class='fnname'>fork</a>(&amp;self) -&gt; Self</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/parse.rs.html#845-854' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Forks a parse stream so that parsing tokens out of either the original
or the fork does not advance the position of the other.</p>
<h1 id="performance" class="section-header"><a href="#performance">Performance</a></h1>
<p>Forking a parse stream is a cheap fixed amount of work and does not
involve copying token buffers. Where you might hit performance problems
is if your macro ends up parsing a large amount of content more than
once.</p>
<pre class="rust rust-example-rendered">
<span class="comment">// Do not do this.</span>
<span class="kw">if</span> <span class="ident">input</span>.<span class="ident">fork</span>().<span class="ident">parse</span>::<span class="op">&lt;</span><span class="ident">Expr</span><span class="op">&gt;</span>().<span class="ident">is_ok</span>() {
<span class="kw">return</span> <span class="ident">input</span>.<span class="ident">parse</span>::<span class="op">&lt;</span><span class="ident">Expr</span><span class="op">&gt;</span>();
}</pre>
<p>As a rule, avoid parsing an unbounded amount of tokens out of a forked
parse stream. Only use a fork when the amount of work performed against
the fork is small and bounded.</p>
<p>For a lower level but occasionally more performant way to perform
speculative parsing, consider using <a href="#method.step"><code>ParseStream::step</code></a> instead.</p>
<h1 id="example-6" class="section-header"><a href="#example-6">Example</a></h1>
<p>The parse implementation shown here parses possibly restricted <code>pub</code>
visibilities.</p>
<ul>
<li><code>pub</code></li>
<li><code>pub(crate)</code></li>
<li><code>pub(self)</code></li>
<li><code>pub(super)</code></li>
<li><code>pub(in some::path)</code></li>
</ul>
<p>To handle the case of visibilities inside of tuple structs, the parser
needs to distinguish parentheses that specify visibility restrictions
from parentheses that form part of a tuple type.</p>
<pre class="rust rust-example-rendered">
<span class="kw">struct</span> <span class="ident">S</span>(<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="ident">A</span>, <span class="kw">pub</span> (<span class="ident">B</span>, <span class="ident">C</span>));</pre>
<p>In this example input the first tuple struct element of <code>S</code> has
<code>pub(crate)</code> visibility while the second tuple struct element has <code>pub</code>
visibility; the parentheses around <code>(B, C)</code> are part of the type rather
than part of a visibility restriction.</p>
<p>The parser uses a forked parse stream to check the first token inside of
parentheses after the <code>pub</code> keyword. This is a small bounded amount of
work performed against the forked parse stream.</p>
<pre class="rust rust-example-rendered">
<span class="attribute">#[<span class="ident">macro_use</span>]</span>
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">syn</span>;
<span class="kw">use</span> <span class="ident">syn</span>::{<span class="ident">token</span>, <span class="ident">Ident</span>, <span class="ident">Path</span>};
<span class="kw">use</span> <span class="ident">syn</span>::<span class="ident">ext</span>::<span class="ident">IdentExt</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="prelude-ty">Result</span>};
<span class="kw">struct</span> <span class="ident">PubVisibility</span> {
<span class="ident">pub_token</span>: <span class="macro">Token</span><span class="macro">!</span>[<span class="kw">pub</span>],
<span class="ident">restricted</span>: <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="ident">Restricted</span><span class="op">&gt;</span>,
}
<span class="kw">struct</span> <span class="ident">Restricted</span> {
<span class="ident">paren_token</span>: <span class="ident">token</span>::<span class="ident">Paren</span>,
<span class="ident">in_token</span>: <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="macro">Token</span><span class="macro">!</span>[<span class="kw">in</span>]<span class="op">&gt;</span>,
<span class="ident">path</span>: <span class="ident">Path</span>,
}
<span class="kw">impl</span> <span class="ident">Parse</span> <span class="kw">for</span> <span class="ident">PubVisibility</span> {
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">input</span>: <span class="ident">ParseStream</span>) <span class="op">-&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="self">Self</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">pub_token</span>: <span class="macro">Token</span><span class="macro">!</span>[<span class="kw">pub</span>] <span class="op">=</span> <span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>;
<span class="kw">if</span> <span class="ident">input</span>.<span class="ident">peek</span>(<span class="ident">token</span>::<span class="ident">Paren</span>) {
<span class="kw">let</span> <span class="ident">ahead</span> <span class="op">=</span> <span class="ident">input</span>.<span class="ident">fork</span>();
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">content</span>;
<span class="macro">parenthesized</span><span class="macro">!</span>(<span class="ident">content</span> <span class="kw">in</span> <span class="ident">ahead</span>);
<span class="kw">if</span> <span class="ident">content</span>.<span class="ident">peek</span>(<span class="macro">Token</span><span class="macro">!</span>[<span class="kw">crate</span>])
<span class="op">||</span> <span class="ident">content</span>.<span class="ident">peek</span>(<span class="macro">Token</span><span class="macro">!</span>[<span class="self">self</span>])
<span class="op">||</span> <span class="ident">content</span>.<span class="ident">peek</span>(<span class="macro">Token</span><span class="macro">!</span>[<span class="kw">super</span>])
{
<span class="kw">return</span> <span class="prelude-val">Ok</span>(<span class="ident">PubVisibility</span> {
<span class="ident">pub_token</span>: <span class="ident">pub_token</span>,
<span class="ident">restricted</span>: <span class="prelude-val">Some</span>(<span class="ident">Restricted</span> {
<span class="ident">paren_token</span>: <span class="macro">parenthesized</span><span class="macro">!</span>(<span class="ident">content</span> <span class="kw">in</span> <span class="ident">input</span>),
<span class="ident">in_token</span>: <span class="prelude-val">None</span>,
<span class="ident">path</span>: <span class="ident">Path</span>::<span class="ident">from</span>(<span class="ident">content</span>.<span class="ident">call</span>(<span class="ident">Ident</span>::<span class="ident">parse_any</span>)<span class="question-mark">?</span>),
}),
});
} <span class="kw">else</span> <span class="kw">if</span> <span class="ident">content</span>.<span class="ident">peek</span>(<span class="macro">Token</span><span class="macro">!</span>[<span class="kw">in</span>]) {
<span class="kw">return</span> <span class="prelude-val">Ok</span>(<span class="ident">PubVisibility</span> {
<span class="ident">pub_token</span>: <span class="ident">pub_token</span>,
<span class="ident">restricted</span>: <span class="prelude-val">Some</span>(<span class="ident">Restricted</span> {
<span class="ident">paren_token</span>: <span class="macro">parenthesized</span><span class="macro">!</span>(<span class="ident">content</span> <span class="kw">in</span> <span class="ident">input</span>),
<span class="ident">in_token</span>: <span class="prelude-val">Some</span>(<span class="ident">content</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>),
<span class="ident">path</span>: <span class="ident">content</span>.<span class="ident">call</span>(<span class="ident">Path</span>::<span class="ident">parse_mod_style</span>)<span class="question-mark">?</span>,
}),
});
}
}
<span class="prelude-val">Ok</span>(<span class="ident">PubVisibility</span> {
<span class="ident">pub_token</span>: <span class="ident">pub_token</span>,
<span class="ident">restricted</span>: <span class="prelude-val">None</span>,
})
}
}</pre>
</div><h4 id='method.error' class="method"><span id='error.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.error' class='fnname'>error</a>&lt;T:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>&gt;(&amp;self, message: T) -&gt; <a class="struct" href="../../syn/parse/struct.Error.html" title="struct syn::parse::Error">Error</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/parse.rs.html#889-891' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Triggers an error at the current position of the parse stream.</p>
<h1 id="example-7" class="section-header"><a href="#example-7">Example</a></h1>
<pre class="rust rust-example-rendered">
<span class="attribute">#[<span class="ident">macro_use</span>]</span>
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">syn</span>;
<span class="kw">use</span> <span class="ident">syn</span>::<span class="ident">Expr</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="prelude-ty">Result</span>};
<span class="comment">// Some kind of loop: `while` or `for` or `loop`.</span>
<span class="kw">struct</span> <span class="ident">Loop</span> {
<span class="ident">expr</span>: <span class="ident">Expr</span>,
}
<span class="kw">impl</span> <span class="ident">Parse</span> <span class="kw">for</span> <span class="ident">Loop</span> {
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">input</span>: <span class="ident">ParseStream</span>) <span class="op">-&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="self">Self</span><span class="op">&gt;</span> {
<span class="kw">if</span> <span class="ident">input</span>.<span class="ident">peek</span>(<span class="macro">Token</span><span class="macro">!</span>[<span class="kw">while</span>])
<span class="op">||</span> <span class="ident">input</span>.<span class="ident">peek</span>(<span class="macro">Token</span><span class="macro">!</span>[<span class="kw">for</span>])
<span class="op">||</span> <span class="ident">input</span>.<span class="ident">peek</span>(<span class="macro">Token</span><span class="macro">!</span>[<span class="kw">loop</span>])
{
<span class="prelude-val">Ok</span>(<span class="ident">Loop</span> {
<span class="ident">expr</span>: <span class="ident">input</span>.<span class="ident">parse</span>()<span class="question-mark">?</span>,
})
} <span class="kw">else</span> {
<span class="prelude-val">Err</span>(<span class="ident">input</span>.<span class="ident">error</span>(<span class="string">&quot;expected some kind of loop&quot;</span>))
}
}
}</pre>
</div><h4 id='method.step' class="method"><span id='step.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.step' class='fnname'>step</a>&lt;F, R&gt;(&amp;self, function: F) -&gt; <a class="type" href="../../syn/parse/type.Result.html" title="type syn::parse::Result">Result</a>&lt;R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: for&lt;'c&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="struct" href="../../syn/parse/struct.StepCursor.html" title="struct syn::parse::StepCursor">StepCursor</a>&lt;'c, 'a&gt;) -&gt; <a class="type" href="../../syn/parse/type.Result.html" title="type syn::parse::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>R, <a class="struct" href="../../syn/buffer/struct.Cursor.html" title="struct syn::buffer::Cursor">Cursor</a>&lt;'c&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>&gt;,&nbsp;</span></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/parse.rs.html#929-957' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Speculatively parses tokens from this parse stream, advancing the
position of this stream only if parsing succeeds.</p>
<p>This is a powerful low-level API used for defining the <code>Parse</code> impls of
the basic built-in token types. It is not something that will be used
widely outside of the Syn codebase.</p>
<h1 id="example-8" class="section-header"><a href="#example-8">Example</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">proc_macro2</span>::<span class="ident">TokenTree</span>;
<span class="kw">use</span> <span class="ident">syn</span>::<span class="ident">parse</span>::{<span class="ident">ParseStream</span>, <span class="prelude-ty">Result</span>};
<span class="comment">// This function advances the stream past the next occurrence of `@`. If</span>
<span class="comment">// no `@` is present in the stream, the stream position is unchanged and</span>
<span class="comment">// an error is returned.</span>
<span class="kw">fn</span> <span class="ident">skip_past_next_at</span>(<span class="ident">input</span>: <span class="ident">ParseStream</span>) <span class="op">-&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span>()<span class="op">&gt;</span> {
<span class="ident">input</span>.<span class="ident">step</span>(<span class="op">|</span><span class="ident">cursor</span><span class="op">|</span> {
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">rest</span> <span class="op">=</span> <span class="kw-2">*</span><span class="ident">cursor</span>;
<span class="kw">while</span> <span class="kw">let</span> <span class="prelude-val">Some</span>((<span class="ident">tt</span>, <span class="ident">next</span>)) <span class="op">=</span> <span class="ident">cursor</span>.<span class="ident">token_tree</span>() {
<span class="kw">match</span> <span class="ident">tt</span> {
<span class="ident">TokenTree</span>::<span class="ident">Punct</span>(<span class="kw-2">ref</span> <span class="ident">punct</span>) <span class="kw">if</span> <span class="ident">punct</span>.<span class="ident">as_char</span>() <span class="op">==</span> <span class="string">&#39;@&#39;</span> <span class="op">=&gt;</span> {
<span class="kw">return</span> <span class="prelude-val">Ok</span>(((), <span class="ident">next</span>));
}
<span class="kw">_</span> <span class="op">=&gt;</span> <span class="ident">rest</span> <span class="op">=</span> <span class="ident">next</span>,
}
}
<span class="prelude-val">Err</span>(<span class="ident">cursor</span>.<span class="ident">error</span>(<span class="string">&quot;no `@` was found after this point&quot;</span>))
})
}</pre>
</div><h4 id='method.cursor' class="method"><span id='cursor.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.cursor' class='fnname'>cursor</a>(&amp;self) -&gt; <a class="struct" href="../../syn/buffer/struct.Cursor.html" title="struct syn::buffer::Cursor">Cursor</a>&lt;'a&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/parse.rs.html#964-966' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Provides low-level access to the token representation underlying this
parse stream.</p>
<p>Cursors are immutable so no operations you perform against the cursor
will affect the state of this parse stream.</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-Drop' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="../../syn/parse/struct.ParseBuffer.html" title="struct syn::parse::ParseBuffer">ParseBuffer</a>&lt;'a&gt;</code><a href='#impl-Drop' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/parse.rs.html#263-269' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.drop' class="method"><span id='drop.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop' class='fnname'>drop</a>(&amp;mut self)</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/parse.rs.html#264-268' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Executes the destructor for this type. <a href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop">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'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;'a&gt; !<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="../../syn/parse/struct.ParseBuffer.html" title="struct syn::parse::ParseBuffer">ParseBuffer</a>&lt;'a&gt;</code><a href='#impl-Send' class='anchor'></a></span></td><td><span class='out-of-band'></span></td></tr></tbody></table></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl&lt;'a&gt; !<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="../../syn/parse/struct.ParseBuffer.html" title="struct syn::parse::ParseBuffer">ParseBuffer</a>&lt;'a&gt;</code><a href='#impl-Sync' class='anchor'></a></span></td><td><span class='out-of-band'></span></td></tr></tbody></table></h3><div class='impl-items'></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 = "syn";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>