Files
GopherGate/target/doc/darling_core/ast/trait.GenericParamExt.html
2026-02-26 12:00:21 -05:00

19 lines
18 KiB
HTML

<!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="Extension trait for `GenericParam` to support getting values by variant."><title>GenericParamExt in darling_core::ast - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.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"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="darling_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.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]--><rustdoc-topbar><h2><a href="#">GenericParamExt</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../darling_core/index.html">darling_<wbr>core</a><span class="version">0.20.11</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Generic<wbr>Param<wbr>Ext</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#usage" title="Usage">Usage</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.ConstParam" title="ConstParam">ConstParam</a></li><li><a href="#associatedtype.LifetimeParam" title="LifetimeParam">LifetimeParam</a></li><li><a href="#associatedtype.TypeParam" title="TypeParam">TypeParam</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.as_const_param" title="as_const_param">as_const_param</a></li><li><a href="#method.as_lifetime_param" title="as_lifetime_param">as_lifetime_param</a></li><li><a href="#method.as_type_param" title="as_type_param">as_type_param</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-GenericParamExt-for-GenericParam" title="GenericParam">GenericParam</a></li><li><a href="#impl-GenericParamExt-for-TypeParam" title="TypeParam">TypeParam</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In darling_<wbr>core::<wbr>ast</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">darling_core</a>::<wbr><a href="index.html">ast</a></div><h1>Trait <span class="trait">Generic<wbr>Param<wbr>Ext</span>&nbsp;<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/darling_core/ast/generics.rs.html#14-34">Source</a> </span></div><pre class="rust item-decl"><code>pub trait GenericParamExt {
type <a href="#associatedtype.TypeParam" class="associatedtype">TypeParam</a>;
type <a href="#associatedtype.LifetimeParam" class="associatedtype">LifetimeParam</a>;
type <a href="#associatedtype.ConstParam" class="associatedtype">ConstParam</a>;
// Provided methods
fn <a href="#method.as_type_param" class="fn">as_type_param</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;Self::<a class="associatedtype" href="trait.GenericParamExt.html#associatedtype.TypeParam" title="type darling_core::ast::GenericParamExt::TypeParam">TypeParam</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.as_lifetime_param" class="fn">as_lifetime_param</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;Self::<a class="associatedtype" href="trait.GenericParamExt.html#associatedtype.LifetimeParam" title="type darling_core::ast::GenericParamExt::LifetimeParam">LifetimeParam</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.as_const_param" class="fn">as_const_param</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;Self::<a class="associatedtype" href="trait.GenericParamExt.html#associatedtype.ConstParam" title="type darling_core::ast::GenericParamExt::ConstParam">ConstParam</a>&gt; { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Extension trait for <code>GenericParam</code> to support getting values by variant.</p>
<h2 id="usage"><a class="doc-anchor" href="#usage">§</a>Usage</h2>
<p><code>darling::ast::Generics</code> needs a way to test its params array in order to iterate over type params.
Rather than require callers to use <code>darling::ast::GenericParam</code> in all cases, this trait makes that
polymorphic.</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"><details class="toggle" open><summary><section id="associatedtype.TypeParam" class="method"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#16">Source</a><h4 class="code-header">type <a href="#associatedtype.TypeParam" class="associatedtype">TypeParam</a></h4></section></summary><div class="docblock"><p>The type this GenericParam uses to represent type params and their bounds</p>
</div></details><section id="associatedtype.LifetimeParam" class="method"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#17">Source</a><h4 class="code-header">type <a href="#associatedtype.LifetimeParam" class="associatedtype">LifetimeParam</a></h4></section><section id="associatedtype.ConstParam" class="method"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#18">Source</a><h4 class="code-header">type <a href="#associatedtype.ConstParam" class="associatedtype">ConstParam</a></h4></section></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.as_type_param" class="method"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#21-23">Source</a><h4 class="code-header">fn <a href="#method.as_type_param" class="fn">as_type_param</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;Self::<a class="associatedtype" href="trait.GenericParamExt.html#associatedtype.TypeParam" title="type darling_core::ast::GenericParamExt::TypeParam">TypeParam</a>&gt;</h4></section></summary><div class="docblock"><p>If this GenericParam is a type param, get the underlying value.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_lifetime_param" class="method"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#26-28">Source</a><h4 class="code-header">fn <a href="#method.as_lifetime_param" class="fn">as_lifetime_param</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;Self::<a class="associatedtype" href="trait.GenericParamExt.html#associatedtype.LifetimeParam" title="type darling_core::ast::GenericParamExt::LifetimeParam">LifetimeParam</a>&gt;</h4></section></summary><div class="docblock"><p>If this GenericParam is a lifetime, get the underlying value.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_const_param" class="method"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#31-33">Source</a><h4 class="code-header">fn <a href="#method.as_const_param" class="fn">as_const_param</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;Self::<a class="associatedtype" href="trait.GenericParamExt.html#associatedtype.ConstParam" title="type darling_core::ast::GenericParamExt::ConstParam">ConstParam</a>&gt;</h4></section></summary><div class="docblock"><p>If this GenericParam is a const param, get the underlying value.</p>
</div></details></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-GenericParamExt-for-GenericParam" class="impl"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#36-64">Source</a><a href="#impl-GenericParamExt-for-GenericParam" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.GenericParamExt.html" title="trait darling_core::ast::GenericParamExt">GenericParamExt</a> for <a class="enum" href="../../syn/generics/enum.GenericParam.html" title="enum syn::generics::GenericParam">GenericParam</a></h3></section></summary><div class="impl-items"><section id="associatedtype.TypeParam-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#37">Source</a><a href="#associatedtype.TypeParam-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.TypeParam" class="associatedtype">TypeParam</a> = <a class="struct" href="../../syn/generics/struct.TypeParam.html" title="struct syn::generics::TypeParam">TypeParam</a></h4></section><section id="associatedtype.LifetimeParam-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#38">Source</a><a href="#associatedtype.LifetimeParam-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.LifetimeParam" class="associatedtype">LifetimeParam</a> = <a class="struct" href="../../syn/generics/struct.LifetimeParam.html" title="struct syn::generics::LifetimeParam">LifetimeParam</a></h4></section><section id="associatedtype.ConstParam-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#39">Source</a><a href="#associatedtype.ConstParam-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.ConstParam" class="associatedtype">ConstParam</a> = <a class="struct" href="../../syn/generics/struct.ConstParam.html" title="struct syn::generics::ConstParam">ConstParam</a></h4></section><section id="method.as_type_param-1" class="method trait-impl"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#41-47">Source</a><a href="#method.as_type_param-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.as_type_param" class="fn">as_type_param</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;Self::<a class="associatedtype" href="trait.GenericParamExt.html#associatedtype.TypeParam" title="type darling_core::ast::GenericParamExt::TypeParam">TypeParam</a>&gt;</h4></section><section id="method.as_lifetime_param-1" class="method trait-impl"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#49-55">Source</a><a href="#method.as_lifetime_param-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.as_lifetime_param" class="fn">as_lifetime_param</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;Self::<a class="associatedtype" href="trait.GenericParamExt.html#associatedtype.LifetimeParam" title="type darling_core::ast::GenericParamExt::LifetimeParam">LifetimeParam</a>&gt;</h4></section><section id="method.as_const_param-1" class="method trait-impl"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#57-63">Source</a><a href="#method.as_const_param-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.as_const_param" class="fn">as_const_param</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;Self::<a class="associatedtype" href="trait.GenericParamExt.html#associatedtype.ConstParam" title="type darling_core::ast::GenericParamExt::ConstParam">ConstParam</a>&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-GenericParamExt-for-TypeParam" class="impl"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#66-74">Source</a><a href="#impl-GenericParamExt-for-TypeParam" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.GenericParamExt.html" title="trait darling_core::ast::GenericParamExt">GenericParamExt</a> for <a class="struct" href="../../syn/generics/struct.TypeParam.html" title="struct syn::generics::TypeParam">TypeParam</a></h3></section></summary><div class="impl-items"><section id="associatedtype.TypeParam-2" class="associatedtype trait-impl"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#67">Source</a><a href="#associatedtype.TypeParam-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.TypeParam" class="associatedtype">TypeParam</a> = <a class="struct" href="../../syn/generics/struct.TypeParam.html" title="struct syn::generics::TypeParam">TypeParam</a></h4></section><section id="associatedtype.LifetimeParam-2" class="associatedtype trait-impl"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#68">Source</a><a href="#associatedtype.LifetimeParam-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.LifetimeParam" class="associatedtype">LifetimeParam</a> = <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a></h4></section><section id="associatedtype.ConstParam-2" class="associatedtype trait-impl"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#69">Source</a><a href="#associatedtype.ConstParam-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.ConstParam" class="associatedtype">ConstParam</a> = <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a></h4></section><section id="method.as_type_param-2" class="method trait-impl"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#71-73">Source</a><a href="#method.as_type_param-2" class="anchor">§</a><h4 class="code-header">fn <a href="#method.as_type_param" class="fn">as_type_param</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;Self::<a class="associatedtype" href="trait.GenericParamExt.html#associatedtype.TypeParam" title="type darling_core::ast::GenericParamExt::TypeParam">TypeParam</a>&gt;</h4></section></div></details><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-GenericParamExt-for-GenericParam%3CT,+L,+C%3E" class="impl"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#104-132">Source</a><a href="#impl-GenericParamExt-for-GenericParam%3CT,+L,+C%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, L, C&gt; <a class="trait" href="trait.GenericParamExt.html" title="trait darling_core::ast::GenericParamExt">GenericParamExt</a> for darling_core::ast::<a class="enum" href="enum.GenericParam.html" title="enum darling_core::ast::GenericParam">GenericParam</a>&lt;T, L, C&gt;</h3></section></summary><div class="impl-items"><section id="associatedtype.TypeParam-3" class="associatedtype trait-impl"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#105">Source</a><a href="#associatedtype.TypeParam-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.TypeParam" class="associatedtype">TypeParam</a> = T</h4></section><section id="associatedtype.LifetimeParam-3" class="associatedtype trait-impl"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#106">Source</a><a href="#associatedtype.LifetimeParam-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.LifetimeParam" class="associatedtype">LifetimeParam</a> = L</h4></section><section id="associatedtype.ConstParam-3" class="associatedtype trait-impl"><a class="src rightside" href="../../src/darling_core/ast/generics.rs.html#107">Source</a><a href="#associatedtype.ConstParam-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.ConstParam" class="associatedtype">ConstParam</a> = C</h4></section></div></details></div><script src="../../trait.impl/darling_core/ast/generics/trait.GenericParamExt.js" data-ignore-extern-crates="syn" async></script></section></div></main></body></html>