edlang/regex_automata/util/alphabet/struct.ByteClasses.html

129 lines
45 KiB
HTML
Raw Normal View History

<!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="A representation of byte oriented equivalence classes."><title>ByteClasses in regex_automata::util::alphabet - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-5bc39a1768837dd0.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="regex_automata" data-themes="" data-resource-suffix="" data-rustdoc-version="1.77.0 (aedd173a2 2024-03-17)" data-channel="1.77.0" data-search-js="search-dd67cee4cfa65049.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../../static.files/storage-4c98445ec4002617.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../static.files/main-48f368f3872407c8.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-04d5337699b92874.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc struct"><!--[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="../../../regex_automata/index.html">regex_automata</a><span class="version">0.4.6</span></h2></div><h2 class="location"><a href="#">ByteClasses</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.alphabet_len">alphabet_len</a></li><li><a href="#method.elements">elements</a></li><li><a href="#method.empty">empty</a></li><li><a href="#method.eoi">eoi</a></li><li><a href="#method.get">get</a></li><li><a href="#method.get_by_unit">get_by_unit</a></li><li><a href="#method.is_singleton">is_singleton</a></li><li><a href="#method.iter">iter</a></li><li><a href="#method.representatives">representatives</a></li><li><a href="#method.set">set</a></li><li><a href="#method.singletons">singletons</a></li><li><a href="#method.stride2">stride2</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Clone-for-ByteClasses">Clone</a></li><li><a href="#impl-Copy-for-ByteClasses">Copy</a></li><li><a href="#impl-Debug-for-ByteClasses">Debug</a></li><li><a href="#impl-Default-for-ByteClasses">Default</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-ByteClasses">RefUnwindSafe</a></li><li><a href="#impl-Send-for-ByteClasses">Send</a></li><li><a href="#impl-Sync-for-ByteClasses">Sync</a></li><li><a href="#impl-Unpin-for-ByteClasses">Unpin</a></li><li><a href="#impl-UnwindSafe-for-ByteClasses">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Impleme
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../../regex_automata/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Struct <a href="../../index.html">regex_automata</a>::<wbr><a href="../index.html">util</a>::<wbr><a href="index.html">alphabet</a>::<wbr><a class="struct" href="#">ByteClasses</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../../../src/regex_automata/util/alphabet.rs.html#215">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub struct ByteClasses(<span class="comment">/* private fields */</span>);</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A representation of byte oriented equivalence classes.</p>
<p>This is used in a DFA to reduce the size of the transition table. This can
have a particularly large impact not only on the total size of a dense DFA,
but also on compile times.</p>
<p>The essential idea here is that the alphabet of a DFA is shrunk from the
usual 256 distinct byte values down to a set of equivalence classes. The
guarantee you get is that any byte belonging to the same equivalence class
can be treated as if it were any other byte in the same class, and the
result of a search wouldnt change.</p>
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
<p>This example shows how to get byte classes from an
<a href="../../nfa/thompson/struct.NFA.html" title="struct regex_automata::nfa::thompson::NFA"><code>NFA</code></a> and ask for the class of various bytes.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex_automata::nfa::thompson::NFA;
<span class="kw">let </span>nfa = NFA::new(<span class="string">"[a-z]+"</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>classes = nfa.byte_classes();
<span class="comment">// 'a' and 'z' are in the same class for this regex.
</span><span class="macro">assert_eq!</span>(classes.get(<span class="string">b'a'</span>), classes.get(<span class="string">b'z'</span>));
<span class="comment">// But 'a' and 'A' are not.
</span><span class="macro">assert_ne!</span>(classes.get(<span class="string">b'a'</span>), classes.get(<span class="string">b'A'</span>));
</code></pre></div>
</div></details><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-ByteClasses" class="impl"><a class="src rightside" href="../../../src/regex_automata/util/alphabet.rs.html#217-483">source</a><a href="#impl-ByteClasses" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.ByteClasses.html" title="struct regex_automata::util::alphabet::ByteClasses">ByteClasses</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.empty" class="method"><a class="src rightside" href="../../../src/regex_automata/util/alphabet.rs.html#221-223">source</a><h4 class="code-header">pub fn <a href="#method.empty" class="fn">empty</a>() -&gt; <a class="struct" href="struct.ByteClasses.html" title="struct regex_automata::util::alphabet::ByteClasses">ByteClasses</a></h4></section></summary><div class="docblock"><p>Creates a new set of equivalence classes where all bytes are mapped to
the same class.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.singletons" class="method"><a class="src rightside" href="../../../src/regex_automata/util/alphabet.rs.html#228-234">source</a><h4 class="code-header">pub fn <a href="#method.singletons" class="fn">singletons</a>() -&gt; <a class="struct" href="struct.ByteClasses.html" title="struct regex_automata::util::alphabet::ByteClasses">ByteClasses</a></h4></section></summary><div class="docblock"><p>Creates a new set of equivalence classes where each byte belongs to
its own equivalence class.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.set" class="method"><a class="src rightside" href="../../../src/regex_automata/util/alphabet.rs.html#288-290">source</a><h4 class="code-header">pub fn <a href="#method.set" class="fn">set</a>(&amp;mut self, byte: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>, class: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>)</h4></section></summary><div class="docblock"><p>Set the equivalence class for the given byte.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get" class="method"><a class="src rightside" href="../../../src/regex_automata/util/alphabet.rs.html#294-296">source</a><h4 class="code-header">pub fn <a href="#method.get" class="fn">get</a>(&amp;self, byte: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a></h4></section></summary><div class="docblock"><p>Get the equivalence class for the given byte.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_by_unit" class="method"><a class="src rightside" href="../../../src/regex_automata/util/alphabet.rs.html#301-306">source</a><h4 class="code-header">pub fn <a href="#method.get_by_unit" class="fn">get_by_unit</a>(&amp;self, unit: <a class="struct" href="struct.Unit.html" title="struct regex_automata::util::alphabet::Unit">Unit</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Get the equivalence class for the given haystack unit and return the
class as a <code>usize</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.eoi" class="method"><a class="src rightside" href="../../../src/regex_automata/util/alphabet.rs.html#311-315">source</a><h4 class="code-header">pub fn <a href="#method.eoi" class="fn">eoi</a>(&amp;self) -&gt; <a class="struct" href="struct.Unit.html" title="struct regex_automata::util::alphabet::Unit">Unit</a></h4></section></summary><div class="docblock"><p>Create a unit that represents the “end of input” sentinel based on the
number of equivalence classes.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.alphabet_len" class="method"><a class="src rightside" href="../../../src/regex_automata/util/alphabet.rs.html#321-326">source</a><h4 class="code-header">pub fn <a href="#method.alphabet_len" class="fn">alphabet_len</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Return the total number of elements in the alphabet represented by
these equivalence classes. Equivalently, this returns the total number
of equivalence classes.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.stride2" class="method"><a class="src rightside" href="../../../src/regex_automata/util/alphabet.rs.html#337-340">source</a><h4 class="code-header">pub fn <a href="#method.stride2" class="fn">stride2</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Returns the stride, as a base-2 exponent, required for these
equivalence classes.</p>
<p>The stride is always the smallest power of 2 that is greater than or
equal to the alphabet length, and the <code>stride2</code> returned here is the
exponent applied to <code>2</code> to get the smallest power. This is done so that
converting between premultiplied state IDs and indices can be done with
shifts alone, which is much faster than integer division.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_singleton" class="method"><a class="src rightside" href="../../../src/regex_automata/util/alphabet.rs.html#347-349">source</a><h4 class="code-header">pub fn <a href="#method.is_singleton" class="fn">is_singleton</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns true if and only if every byte in this class maps to its own
equivalence class. Equivalently, there are 257 equivalence classes
and each class contains either exactly one byte or corresponds to the
singleton class containing the “end of input” sentinel.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.iter" class="method"><a class="src rightside" href="../../../src/regex_automata/util/alphabet.rs.html#353-355">source</a><h4 class="code-header">pub fn <a href="#method.iter" class="fn">iter</a>(&amp;self) -&gt; <a class="struct" href="struct.ByteClassIter.html" title="struct regex_automata::util::alphabet::ByteClassIter">ByteClassIter</a>&lt;'_&gt; <a href="#" class="tooltip" data-notable-ty="ByteClassIter&lt;&#39;_&gt;"></a></h4></section></summary><div class="docblock"><p>Returns an iterator over all equivalence classes in this set.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.representatives" class="method"><a class="src rightside" href="../../../src/regex_automata/util/alphabet.rs.html#412-441">source</a><h4 class="code-header">pub fn <a href="#method.representatives" class="fn">representatives</a>&lt;R: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/range/trait.RangeBounds.html" title="trait core::ops::range::RangeBounds">RangeBounds</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>&gt;&gt;(
&amp;self,
range: R
) -&gt; <a class="struct" href="struct.ByteClassRepresentatives.html" title="struct regex_automata::util::alphabet::ByteClassRepresentatives">ByteClassRepresentatives</a>&lt;'_&gt; <a href="#" class="tooltip" data-notable-ty="ByteClassRepresentatives&lt;&#39;_&gt;"></a></h4></section></summary><div class="docblock"><p>Returns an iterator over a sequence of representative bytes from each
equivalence class within the range of bytes given.</p>
<p>When the given range is unbounded on both sides, the iterator yields
exactly N items, where N is equivalent to the number of equivalence
classes. Each item is an arbitrary byte drawn from each equivalence
class.</p>
<p>This is useful when one is determinizing an NFA and the NFAs alphabet
hasnt been converted to equivalence classes. Picking an arbitrary byte
from each equivalence class then permits a full exploration of the NFA
instead of using every possible byte value and thus potentially saves
quite a lot of redundant work.</p>
<h5 id="example-1"><a class="doc-anchor" href="#example-1">§</a>Example</h5>
<p>This shows an example of what a complete sequence of representatives
might look like from a real example.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex_automata::{nfa::thompson::NFA, util::alphabet::Unit};
<span class="kw">let </span>nfa = NFA::new(<span class="string">"[a-z]+"</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>classes = nfa.byte_classes();
<span class="kw">let </span>reps: Vec&lt;Unit&gt; = classes.representatives(..).collect();
<span class="comment">// Note that the specific byte values yielded are not guaranteed!
</span><span class="kw">let </span>expected = <span class="macro">vec!</span>[
Unit::u8(<span class="string">b'\x00'</span>),
Unit::u8(<span class="string">b'a'</span>),
Unit::u8(<span class="string">b'{'</span>),
Unit::eoi(<span class="number">3</span>),
];
<span class="macro">assert_eq!</span>(expected, reps);
</code></pre></div>
<p>Note though, that you can ask for an arbitrary range of bytes, and only
representatives for that range will be returned:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex_automata::{nfa::thompson::NFA, util::alphabet::Unit};
<span class="kw">let </span>nfa = NFA::new(<span class="string">"[a-z]+"</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>classes = nfa.byte_classes();
<span class="kw">let </span>reps: Vec&lt;Unit&gt; = classes.representatives(<span class="string">b'A'</span>..=<span class="string">b'z'</span>).collect();
<span class="comment">// Note that the specific byte values yielded are not guaranteed!
</span><span class="kw">let </span>expected = <span class="macro">vec!</span>[
Unit::u8(<span class="string">b'A'</span>),
Unit::u8(<span class="string">b'a'</span>),
];
<span class="macro">assert_eq!</span>(expected, reps);
</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.elements" class="method"><a class="src rightside" href="../../../src/regex_automata/util/alphabet.rs.html#472-474">source</a><h4 class="code-header">pub fn <a href="#method.elements" class="fn">elements</a>(&amp;self, class: <a class="struct" href="struct.Unit.html" title="struct regex_automata::util::alphabet::Unit">Unit</a>) -&gt; <a class="struct" href="struct.ByteClassElements.html" title="struct regex_automata::util::alphabet::ByteClassElements">ByteClassElements</a>&lt;'_&gt; <a href="#" class="tooltip" data-notable-ty="ByteClassElements&lt;&#39;_&gt;"></a></h4></section></summary><div class="docblock"><p>Returns an iterator of the bytes in the given equivalence class.</p>
<p>This is useful when one needs to know the actual bytes that belong to
an equivalence class. For example, conceptually speaking, accelerating
a DFA state occurs when a state only has a few outgoing transitions.
But in reality, what is required is that there are only a small
number of distinct bytes that can lead to an outgoing transition. The
difference is that any one transition can correspond to an equivalence
class which may contains many bytes. Therefore, DFA state acceleration
considers the actual elements in each equivalence class of each
outgoing transition.</p>
<h5 id="example-2"><a class="doc-anchor" href="#example-2">§</a>Example</h5>
<p>This shows an example of how to get all of the elements in an
equivalence class.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex_automata::{nfa::thompson::NFA, util::alphabet::Unit};
<span class="kw">let </span>nfa = NFA::new(<span class="string">"[a-z]+"</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>classes = nfa.byte_classes();
<span class="kw">let </span>elements: Vec&lt;Unit&gt; = classes.elements(Unit::u8(<span class="number">1</span>)).collect();
<span class="kw">let </span>expected: Vec&lt;Unit&gt; = (<span class="string">b'a'</span>..=<span class="string">b'z'</span>).map(Unit::u8).collect();
<span class="macro">assert_eq!</span>(expected, elements);
</code></pre></div>
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Clone-for-ByteClasses" class="impl"><a class="src rightside" href="../../../src/regex_automata/util/alphabet.rs.html#214">source</a><a href="#impl-Clone-for-ByteClasses" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.ByteClasses.html" title="struct regex_automata::util::alphabet::ByteClasses">ByteClasses</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl"><a class="src rightside" href="../../../src/regex_automata/util/alphabet.rs.html#214">source</a><a href="#method.clone" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&amp;self) -&gt; <a class="struct" href="struct.ByteClasses.html" title="struct regex_automata::util::alphabet::ByteClasses">ByteClasses</a></h4></section></summary><div class='docblock'>Returns a copy of the value. <a href="https://doc.rust-lang.org/1.77.0/core/clone/trait.Clone.html#tymethod.clone">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/clone.rs.html#169">source</a></span><a href="#method.clone_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/clone/trait.Clone.html#method.clone_from" class="fn">clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&amp;Self</a>)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/1.77.0/core/clone/trait.Clone.html#method.clone_from">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-ByteClasses" class="impl"><a class="src rightside" href="../../../src/regex_automata/util/alphabet.rs.html#491-514">source</a><a href="#impl-Debug-for-ByteClasses" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.ByteClasses.html" title="struct regex_automata::util::alphabet::ByteClasses">ByteClasses</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../../../src/regex_automata/util/alphabet.rs.html#492-513">source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.77.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.77.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-ByteClasses" class="impl"><a class="src rightside" href="../../../src/regex_automata/util/alphabet.rs.html#485-489">source</a><a hre
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/any.rs.html#141">source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.77.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/borrow.rs.html#208">source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/borrow.rs.html#210">source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&amp;T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.77.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/borrow.rs.html#216">source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/borrow.rs.html#217">source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&amp;mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.77.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/convert/mod.rs.html#764">source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/convert/mod.rs.html#767">source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/convert/mod.rs.html#747-749">source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/convert/mod.rs.html#757">source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code><a href="https://doc.rust-lang.org/1.77.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToOwned-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/alloc/borrow.rs.html#83-85">source</a><a href="#impl-ToOwned-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl"><a href="#associatedtype.Owned" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/alloc/borrow.rs.html#88">source</a><a href="#method.to_owned" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fn">to_owned</a>(&amp;self) -&gt; T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/alloc/borrow.rs.html#92">source</a><a href="#method.clone_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fn">clone_into</a>(&amp;self, target: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&amp;mut T</a>)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/convert/mod.rs.html#804-806">source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/convert/mod.rs.html#811">source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/convert/mod.rs.html#789-791">source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/convert/mod.rs.html#796">source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div><script type="text/json" id="notable-traits-data">{"ByteClassElements<'_>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.ByteClassElements.html\" title=\"struct regex_automata::util::alphabet::ByteClassElements\">ByteClassElements</a>&lt;'a&gt;</code></h3><pre><code><div class=\"where\">impl&lt;'a&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.ByteClassElements.html\" title=\"struct regex_automata::util::alphabet::ByteClassElements\">ByteClassElements</a>&lt;'a&gt;</div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"struct.Unit.html\" title=\"struct regex_automata::util::alphabet::Unit\">Unit</a>;</div>","ByteClassIter<'_>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.ByteClassIter.html\" title=\"struct regex_automata::util::alphabet::ByteClassIter\">ByteClassIter</a>&lt;'a&gt;</code></h3><pre><code><div class=\"where\">impl&lt;'a&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.ByteClassIter.html\" title=\"struct regex_automata::util::alphabet::ByteClassIter\">ByteClassIter</a>&lt;'a&gt;</div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"struct.Unit.html\" title=\"struct regex_automata::util::alphabet::Unit\">Unit</a>;</div>","ByteClassRepresentatives<'_>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.ByteClassRepresentatives.html\" title=\"struct regex_automata::util::alphabet::ByteClassRepresentatives\">ByteClassRepresentatives</a>&lt;'a&gt;</code></h3><pre><code><div class=\"where\"