Auto Generated Documentation

This commit is contained in:
github-actions[bot]
2025-04-02 13:41:38 +00:00
parent e9a232e07d
commit 21efed14f2
18523 changed files with 340249 additions and 282417 deletions
+22 -25
View File
@@ -1,28 +1,25 @@
<!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="Parser that can parse Rust tokens into a particular syntax tree node."><meta name="keywords" content="rust, rustlang, rust-lang, Parser"><title>Parser in syn::parse - 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 trait"><!--[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">&#9776;</div><a href='../../syn/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Trait Parser</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#associated-types">Associated Types</a><div class="sidebar-links"><a href="#associatedtype.Output">Output</a></div><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.parse2">parse2</a></div><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.parse">parse</a><a href="#method.parse_str">parse_str</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class="location"><a href="../index.html">syn</a>::<wbr><a href="index.html">parse</a></p><div id="sidebar-vars" data-name="Parser" data-ty="trait" 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">Trait <a href="../index.html">syn</a>::<wbr><a href="index.html">parse</a>::<wbr><a class="trait" href="">Parser</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">&#x2212;</span>]</a></span><a class="srclink" href="../../src/syn/parse.rs.html#1140-1191" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><pre class="rust trait">pub trait Parser: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
type <a href="#associatedtype.Output" class="type">Output</a>;
fn <a href="#tymethod.parse2" class="fnname">parse2</a>(self, tokens: <a class="struct" href="../../proc_macro2/struct.TokenStream.html" title="struct proc_macro2::TokenStream">TokenStream</a>) -&gt; <a class="type" href="type.Result.html" title="type syn::parse::Result">Result</a>&lt;Self::<a class="type" href="trait.Parser.html#associatedtype.Output" title="type syn::parse::Parser::Output">Output</a>&gt;;
<!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="Parser that can parse Rust tokens into a particular syntax tree node."><title>Parser in syn::parse - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-46132b98.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="syn" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.1 (4eb161250 2025-03-15)" data-channel="1.85.1" data-search-js="search-75f5ac3e.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../syn/index.html">syn</a><span class="version">2.0.100</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Parser</a></h2><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Output" title="Output">Output</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.parse2" title="parse2">parse2</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.parse" title="parse">parse</a></li><li><a href="#method.parse_str" title="parse_str">parse_str</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In syn::<wbr>parse</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">syn</a>::<wbr><a href="index.html">parse</a></span><h1>Trait <span class="trait">Parser</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/syn/parse.rs.html#1239-1277">Source</a> </span></div><pre class="rust item-decl"><code>pub trait Parser: <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
type <a href="#associatedtype.Output" class="associatedtype">Output</a>;
fn <a href="#method.parse" class="fnname">parse</a>(self, tokens: <a class="struct" href="https://doc.rust-lang.org/nightly/proc_macro/struct.TokenStream.html" title="struct proc_macro::TokenStream">TokenStream</a>) -&gt; <a class="type" href="type.Result.html" title="type syn::parse::Result">Result</a>&lt;Self::<a class="type" href="trait.Parser.html#associatedtype.Output" title="type syn::parse::Parser::Output">Output</a>&gt; { ... }
<div class="item-spacer"></div> fn <a href="#method.parse_str" class="fnname">parse_str</a>(self, s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="type" href="type.Result.html" title="type syn::parse::Result">Result</a>&lt;Self::<a class="type" href="trait.Parser.html#associatedtype.Output" title="type syn::parse::Parser::Output">Output</a>&gt; { ... }
}</pre></div><div class="docblock"><p>Parser that can parse Rust tokens into a particular syntax tree node.</p>
<p>Refer to the <a href="index.html">module documentation</a> for details about parsing in Syn.</p>
<p><em>This trait is available only if Syn is built with the <code>&quot;parsing&quot;</code> feature.</em></p>
</div><h2 id="associated-types" class="small-section-header">Associated Types<a href="#associated-types" class="anchor"></a></h2><div class="methods"><h3 id="associatedtype.Output" class="method"><code>type <a href="#associatedtype.Output" class="type">Output</a></code><a class="srclink" href="../../src/syn/parse.rs.html#1141" title="goto source code">[src]</a></h3></div><span class="loading-content">Loading content...</span><h2 id="required-methods" class="small-section-header">Required methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><h3 id="tymethod.parse2" class="method"><code>fn <a href="#tymethod.parse2" class="fnname">parse2</a>(self, tokens: <a class="struct" href="../../proc_macro2/struct.TokenStream.html" title="struct proc_macro2::TokenStream">TokenStream</a>) -&gt; <a class="type" href="type.Result.html" title="type syn::parse::Result">Result</a>&lt;Self::<a class="type" href="trait.Parser.html#associatedtype.Output" title="type syn::parse::Parser::Output">Output</a>&gt;</code><a class="srclink" href="../../src/syn/parse.rs.html#1147" title="goto source code">[src]</a></h3><div class="docblock"><p>Parse a proc-macro2 token stream into the chosen syntax tree node.</p>
<p>This function will check that the input is fully parsed. If there are
any unparsed tokens at the end of the stream, an error is returned.</p>
</div></div><span class="loading-content">Loading content...</span><h2 id="provided-methods" class="small-section-header">Provided methods<a href="#provided-methods" class="anchor"></a></h2><div class="methods"><h3 id="method.parse" class="method"><code>fn <a href="#method.parse" class="fnname">parse</a>(self, tokens: <a class="struct" href="https://doc.rust-lang.org/nightly/proc_macro/struct.TokenStream.html" title="struct proc_macro::TokenStream">TokenStream</a>) -&gt; <a class="type" href="type.Result.html" title="type syn::parse::Result">Result</a>&lt;Self::<a class="type" href="trait.Parser.html#associatedtype.Output" title="type syn::parse::Parser::Output">Output</a>&gt;</code><a class="srclink" href="../../src/syn/parse.rs.html#1160-1162" title="goto source code">[src]</a></h3><div class="docblock"><p>Parse tokens of source code into the chosen syntax tree node.</p>
<p>This function will check that the input is fully parsed. If there are
any unparsed tokens at the end of the stream, an error is returned.</p>
<p><em>This method is available only if Syn is built with both the <code>&quot;parsing&quot;</code> and
<code>&quot;proc-macro&quot;</code> features.</em></p>
</div><h3 id="method.parse_str" class="method"><code>fn <a href="#method.parse_str" class="fnname">parse_str</a>(self, s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="type" href="type.Result.html" title="type syn::parse::Result">Result</a>&lt;Self::<a class="type" href="trait.Parser.html#associatedtype.Output" title="type syn::parse::Parser::Output">Output</a>&gt;</code><a class="srclink" href="../../src/syn/parse.rs.html#1173-1175" title="goto source code">[src]</a></h3><div class="docblock"><p>Parse a string of Rust code into the chosen syntax tree node.</p>
<p>This function will check that the input is fully parsed. If there are
any unparsed tokens at the end of the string, an error is returned.</p>
<h1 id="hygiene" class="section-header"><a href="#hygiene">Hygiene</a></h1>
// Required method
fn <a href="#tymethod.parse2" class="fn">parse2</a>(self, tokens: <a class="struct" href="../../proc_macro2/struct.TokenStream.html" title="struct proc_macro2::TokenStream">TokenStream</a>) -&gt; <a class="type" href="../type.Result.html" title="type syn::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Parser.html#associatedtype.Output" title="type syn::parse::Parser::Output">Output</a>&gt;;
// Provided methods
fn <a href="#method.parse" class="fn">parse</a>(self, tokens: <a class="struct" href="https://doc.rust-lang.org/1.85.1/proc_macro/struct.TokenStream.html" title="struct proc_macro::TokenStream">TokenStream</a>) -&gt; <a class="type" href="../type.Result.html" title="type syn::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Parser.html#associatedtype.Output" title="type syn::parse::Parser::Output">Output</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.parse_str" class="fn">parse_str</a>(self, s: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.str.html">str</a>) -&gt; <a class="type" href="../type.Result.html" title="type syn::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Parser.html#associatedtype.Output" title="type syn::parse::Parser::Output">Output</a>&gt; { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Parser that can parse Rust tokens into a particular syntax tree node.</p>
<p>Refer to the <a href="index.html" title="mod syn::parse">module documentation</a> for details about parsing in Syn.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><section id="associatedtype.Output" class="method"><a class="src rightside" href="../../src/syn/parse.rs.html#1240">Source</a><h4 class="code-header">type <a href="#associatedtype.Output" class="associatedtype">Output</a></h4></section></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.parse2" class="method"><a class="src rightside" href="../../src/syn/parse.rs.html#1246">Source</a><h4 class="code-header">fn <a href="#tymethod.parse2" class="fn">parse2</a>(self, tokens: <a class="struct" href="../../proc_macro2/struct.TokenStream.html" title="struct proc_macro2::TokenStream">TokenStream</a>) -&gt; <a class="type" href="../type.Result.html" title="type syn::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Parser.html#associatedtype.Output" title="type syn::parse::Parser::Output">Output</a>&gt;</h4></section></summary><div class="docblock"><p>Parse a proc-macro2 token stream into the chosen syntax tree node.</p>
<p>This function enforces that the input is fully parsed. If there are any
unparsed tokens at the end of the stream, an error is returned.</p>
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.parse" class="method"><a class="src rightside" href="../../src/syn/parse.rs.html#1254-1256">Source</a><h4 class="code-header">fn <a href="#method.parse" class="fn">parse</a>(self, tokens: <a class="struct" href="https://doc.rust-lang.org/1.85.1/proc_macro/struct.TokenStream.html" title="struct proc_macro::TokenStream">TokenStream</a>) -&gt; <a class="type" href="../type.Result.html" title="type syn::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Parser.html#associatedtype.Output" title="type syn::parse::Parser::Output">Output</a>&gt;</h4></section></summary><div class="docblock"><p>Parse tokens of source code into the chosen syntax tree node.</p>
<p>This function enforces that the input is fully parsed. If there are any
unparsed tokens at the end of the stream, an error is returned.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_str" class="method"><a class="src rightside" href="../../src/syn/parse.rs.html#1267-1269">Source</a><h4 class="code-header">fn <a href="#method.parse_str" class="fn">parse_str</a>(self, s: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.85.1/std/primitive.str.html">str</a>) -&gt; <a class="type" href="../type.Result.html" title="type syn::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Parser.html#associatedtype.Output" title="type syn::parse::Parser::Output">Output</a>&gt;</h4></section></summary><div class="docblock"><p>Parse a string of Rust code into the chosen syntax tree node.</p>
<p>This function enforces that the input is fully parsed. If there are any
unparsed tokens at the end of the string, an error is returned.</p>
<h5 id="hygiene"><a class="doc-anchor" href="#hygiene">§</a>Hygiene</h5>
<p>Every span in the resulting syntax tree will be set to resolve at the
macro call site.</p>
</div></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"><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-Parser" class="impl"><code class="in-band">impl&lt;F, T&gt; <a class="trait" href="trait.Parser.html" title="trait syn::parse::Parser">Parser</a> for F <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <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="type" href="type.ParseStream.html" title="type syn::parse::ParseStream">ParseStream</a>&lt;'_&gt;) -&gt; <a class="type" href="type.Result.html" title="type syn::parse::Result">Result</a>&lt;T&gt;,&nbsp;</span></code><a href="#impl-Parser" class="anchor"></a><a class="srclink" href="../../src/syn/parse.rs.html#1200-1239" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="associatedtype.Output-1" class="type trait-impl"><code>type <a href="#associatedtype.Output" class="type">Output</a> = T</code><a href="#associatedtype.Output-1" class="anchor"></a></h4><h4 id="method.parse2" class="method hidden trait-impl"><code>fn <a href="#tymethod.parse2" class="fnname">parse2</a>(self, tokens: <a class="struct" href="../../proc_macro2/struct.TokenStream.html" title="struct proc_macro2::TokenStream">TokenStream</a>) -&gt; <a class="type" href="type.Result.html" title="type syn::parse::Result">Result</a>&lt;T&gt;</code><a href="#method.parse2" class="anchor"></a><a class="srclink" href="../../src/syn/parse.rs.html#1206-1216" title="goto source code">[src]</a></h4></div></details></div><span class="loading-content">Loading content...</span><script type="text/javascript" src="../../implementors/syn/parse/trait.Parser.js" async></script></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>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.85.1/reference/items/traits.html#object-safety">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-Parser-for-F" class="impl"><a class="src rightside" href="../../src/syn/parse.rs.html#1286-1321">Source</a><a href="#impl-Parser-for-F" class="anchor">§</a><h3 class="code-header">impl&lt;F, T&gt; <a class="trait" href="trait.Parser.html" title="trait syn::parse::Parser">Parser</a> for F<div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.85.1/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="type" href="type.ParseStream.html" title="type syn::parse::ParseStream">ParseStream</a>&lt;'_&gt;) -&gt; <a class="type" href="../type.Result.html" title="type syn::Result">Result</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Output-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/syn/parse.rs.html#1290">Source</a><a href="#associatedtype.Output-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Output" class="associatedtype">Output</a> = T</h4></section></div></details></div><script src="../../trait.impl/syn/parse/trait.Parser.js" async></script></section></div></main></body></html>