|
6 | 6 | }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>This processor assigns names to all the things in a module
|
7 | 7 | that may need identifiers in a textual backend.</p>
|
8 | 8 | </div></details><h2 id="fields" class="fields section-header">Fields<a href="#fields" class="anchor">§</a></h2><span id="structfield.unique" class="structfield section-header"><a href="#structfield.unique" class="anchor field">§</a><code>unique: <a class="type" href="../../type.FastHashMap.html" title="type naga::FastHashMap">FastHashMap</a><<a class="struct" href="https://doc.rust-lang.org/1.88.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="primitive" href="https://doc.rust-lang.org/1.88.0/std/primitive.u32.html">u32</a>></code></span><div class="docblock"><p>The last numeric suffix used for each base name. Zero means “no suffix”.</p>
|
9 |
| -</div><span id="structfield.keywords" class="structfield section-header"><a href="#structfield.keywords" class="anchor field">§</a><code>keywords: &'static <a class="struct" href="../struct.KeywordSet.html" title="struct naga::proc::KeywordSet">KeywordSet</a></code></span><span id="structfield.keywords_case_insensitive" class="structfield section-header"><a href="#structfield.keywords_case_insensitive" class="anchor field">§</a><code>keywords_case_insensitive: &'static <a class="struct" href="../struct.CaseInsensitiveKeywordSet.html" title="struct naga::proc::CaseInsensitiveKeywordSet">CaseInsensitiveKeywordSet</a></code></span><span id="structfield.reserved_prefixes" class="structfield section-header"><a href="#structfield.reserved_prefixes" class="anchor field">§</a><code>reserved_prefixes: <a class="struct" href="https://doc.rust-lang.org/1.88.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><&'static <a class="primitive" href="https://doc.rust-lang.org/1.88.0/std/primitive.str.html">str</a>></code></span><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Namer" class="impl"><a class="src rightside" href="../../../src/naga/proc/namer.rs.html#97-361">Source</a><a href="#impl-Namer" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="../struct.Namer.html" title="struct naga::proc::Namer">Namer</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.sanitize" class="method"><a class="src rightside" href="../../../src/naga/proc/namer.rs.html#108-146">Source</a><h4 class="code-header">fn <a href="#method.sanitize" class="fn">sanitize</a><'s>(&self, string: &'s <a class="primitive" href="https://doc.rust-lang.org/1.88.0/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.88.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a><'s, <a class="primitive" href="https://doc.rust-lang.org/1.88.0/std/primitive.str.html">str</a>></h4></section></summary><div class="docblock"><p>Return a form of <code>string</code> suitable for use as the base of an identifier.</p> |
| 9 | +</div><span id="structfield.keywords" class="structfield section-header"><a href="#structfield.keywords" class="anchor field">§</a><code>keywords: &'static <a class="struct" href="../struct.KeywordSet.html" title="struct naga::proc::KeywordSet">KeywordSet</a></code></span><span id="structfield.keywords_case_insensitive" class="structfield section-header"><a href="#structfield.keywords_case_insensitive" class="anchor field">§</a><code>keywords_case_insensitive: &'static <a class="struct" href="../struct.CaseInsensitiveKeywordSet.html" title="struct naga::proc::CaseInsensitiveKeywordSet">CaseInsensitiveKeywordSet</a></code></span><span id="structfield.reserved_prefixes" class="structfield section-header"><a href="#structfield.reserved_prefixes" class="anchor field">§</a><code>reserved_prefixes: <a class="struct" href="https://doc.rust-lang.org/1.88.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><&'static <a class="primitive" href="https://doc.rust-lang.org/1.88.0/std/primitive.str.html">str</a>></code></span><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Namer" class="impl"><a class="src rightside" href="../../../src/naga/proc/namer.rs.html#97-378">Source</a><a href="#impl-Namer" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="../struct.Namer.html" title="struct naga::proc::Namer">Namer</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.sanitize" class="method"><a class="src rightside" href="../../../src/naga/proc/namer.rs.html#108-163">Source</a><h4 class="code-header">fn <a href="#method.sanitize" class="fn">sanitize</a><'s>(&self, string: &'s <a class="primitive" href="https://doc.rust-lang.org/1.88.0/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.88.0/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a><'s, <a class="primitive" href="https://doc.rust-lang.org/1.88.0/std/primitive.str.html">str</a>></h4></section></summary><div class="docblock"><p>Return a form of <code>string</code> suitable for use as the base of an identifier.</p> |
10 | 10 | <ul>
|
11 | 11 | <li>Drop leading digits.</li>
|
12 | 12 | <li>Retain only alphanumeric and <code>_</code> characters.</li>
|
|
16 | 16 | <p>The return value is a valid identifier prefix in all of Naga’s output languages,
|
17 | 17 | and it never ends with a <code>SEPARATOR</code> character.
|
18 | 18 | It is used as a key into the unique table.</p>
|
19 |
| -</div></details><details class="toggle method-toggle" open><summary><section id="method.call" class="method"><a class="src rightside" href="../../../src/naga/proc/namer.rs.html#158-192">Source</a><h4 class="code-header">pub fn <a href="#method.call" class="fn">call</a>(&mut self, label_raw: &<a class="primitive" href="https://doc.rust-lang.org/1.88.0/std/primitive.str.html">str</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.88.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class="docblock"><p>Return a new identifier based on <code>label_raw</code>.</p> |
| 19 | +</div></details><details class="toggle method-toggle" open><summary><section id="method.call" class="method"><a class="src rightside" href="../../../src/naga/proc/namer.rs.html#175-209">Source</a><h4 class="code-header">pub fn <a href="#method.call" class="fn">call</a>(&mut self, label_raw: &<a class="primitive" href="https://doc.rust-lang.org/1.88.0/std/primitive.str.html">str</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.88.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class="docblock"><p>Return a new identifier based on <code>label_raw</code>.</p> |
20 | 20 | <p>The result:</p>
|
21 | 21 | <ul>
|
22 | 22 | <li>is a valid identifier even if <code>label_raw</code> is not</li>
|
|
26 | 26 | </ul>
|
27 | 27 | <p>Guarantee uniqueness by applying a numeric suffix when necessary. If <code>label_raw</code>
|
28 | 28 | itself ends with digits, separate them from the suffix with an underscore.</p>
|
29 |
| -</div></details><section id="method.call_or" class="method"><a class="src rightside" href="../../../src/naga/proc/namer.rs.html#194-199">Source</a><h4 class="code-header">pub fn <a href="#method.call_or" class="fn">call_or</a>(&mut self, label: &<a class="enum" href="https://doc.rust-lang.org/1.88.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.88.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, fallback: &<a class="primitive" href="https://doc.rust-lang.org/1.88.0/std/primitive.str.html">str</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.88.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section><details class="toggle method-toggle" open><summary><section id="method.namespace" class="method"><a class="src rightside" href="../../../src/naga/proc/namer.rs.html#206-211">Source</a><h4 class="code-header">fn <a href="#method.namespace" class="fn">namespace</a>(&mut self, capacity: <a class="primitive" href="https://doc.rust-lang.org/1.88.0/std/primitive.usize.html">usize</a>, body: impl <a class="trait" href="https://doc.rust-lang.org/1.88.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&mut Self))</h4></section></summary><div class="docblock"><p>Enter a local namespace for things like structs.</p> |
| 29 | +</div></details><section id="method.call_or" class="method"><a class="src rightside" href="../../../src/naga/proc/namer.rs.html#211-216">Source</a><h4 class="code-header">pub fn <a href="#method.call_or" class="fn">call_or</a>(&mut self, label: &<a class="enum" href="https://doc.rust-lang.org/1.88.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.88.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, fallback: &<a class="primitive" href="https://doc.rust-lang.org/1.88.0/std/primitive.str.html">str</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.88.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section><details class="toggle method-toggle" open><summary><section id="method.namespace" class="method"><a class="src rightside" href="../../../src/naga/proc/namer.rs.html#223-228">Source</a><h4 class="code-header">fn <a href="#method.namespace" class="fn">namespace</a>(&mut self, capacity: <a class="primitive" href="https://doc.rust-lang.org/1.88.0/std/primitive.usize.html">usize</a>, body: impl <a class="trait" href="https://doc.rust-lang.org/1.88.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&mut Self))</h4></section></summary><div class="docblock"><p>Enter a local namespace for things like structs.</p> |
30 | 30 | <p>Struct member names only need to be unique amongst themselves, not
|
31 | 31 | globally. This function temporarily establishes a fresh, empty naming
|
32 | 32 | context for the duration of the call to <code>body</code>.</p>
|
33 |
| -</div></details><section id="method.reset" class="method"><a class="src rightside" href="../../../src/naga/proc/namer.rs.html#213-360">Source</a><h4 class="code-header">pub fn <a href="#method.reset" class="fn">reset</a>( |
| 33 | +</div></details><section id="method.reset" class="method"><a class="src rightside" href="../../../src/naga/proc/namer.rs.html#230-377">Source</a><h4 class="code-header">pub fn <a href="#method.reset" class="fn">reset</a>( |
34 | 34 | &mut self,
|
35 | 35 | module: &<a class="struct" href="../../ir/struct.Module.html" title="struct naga::ir::Module">Module</a>,
|
36 | 36 | reserved_keywords: &'static <a class="struct" href="../struct.KeywordSet.html" title="struct naga::proc::KeywordSet">KeywordSet</a>,
|
|
0 commit comments