blob: e4cc4f79ca63e26acca83eba18af1ff70b584d33 [file] [log] [blame]
<!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="Extracts prefix or suffix literal sequences from [`Hir`] expressions."><meta name="keywords" content="rust, rustlang, rust-lang, Extractor"><title>Extractor in regex_syntax::hir::literal - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../../../normalize.css"><link rel="stylesheet" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../../../ayu.css" disabled><link rel="stylesheet" href="../../../dark.css" disabled><link rel="stylesheet" href="../../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../main.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../../favicon.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">&#9776;</button><a class="sidebar-logo" href="../../../regex_syntax/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../../regex_syntax/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Extractor</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block"><li><a href="#method.extract">extract</a></li><li><a href="#method.kind">kind</a></li><li><a href="#method.limit_class">limit_class</a></li><li><a href="#method.limit_literal_len">limit_literal_len</a></li><li><a href="#method.limit_repeat">limit_repeat</a></li><li><a href="#method.limit_total">limit_total</a></li><li><a href="#method.new">new</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block"><li><a href="#impl-Clone-for-Extractor">Clone</a></li><li><a href="#impl-Debug-for-Extractor">Debug</a></li><li><a href="#impl-Default-for-Extractor">Default</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block"><li><a href="#impl-RefUnwindSafe-for-Extractor">RefUnwindSafe</a></li><li><a href="#impl-Send-for-Extractor">Send</a></li><li><a href="#impl-Sync-for-Extractor">Sync</a></li><li><a href="#impl-Unpin-for-Extractor">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Extractor">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block"><li><a href="#impl-Any-for-Extractor">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-Extractor">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-Extractor">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-From%3CT%3E-for-Extractor">From&lt;T&gt;</a></li><li><a href="#impl-Into%3CU%3E-for-Extractor">Into&lt;U&gt;</a></li><li><a href="#impl-ToOwned-for-Extractor">ToOwned</a></li><li><a href="#impl-TryFrom%3CU%3E-for-Extractor">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-Extractor">TryInto&lt;U&gt;</a></li></ul></section><h2><a href="index.html">In regex_syntax::hir::literal</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Struct <a href="../../index.html">regex_syntax</a>::<wbr><a href="../index.html">hir</a>::<wbr><a href="index.html">literal</a>::<wbr><a class="struct" href="#">Extractor</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../../src/regex_syntax/hir/literal.rs.html#147-153">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="item-decl"><pre class="rust struct"><code>pub struct Extractor { /* private fields */ }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Extracts prefix or suffix literal sequences from <a href="../struct.Hir.html" title="Hir"><code>Hir</code></a> expressions.</p>
<p>Literal extraction is based on the following observations:</p>
<ul>
<li>Many regexes start with one or a small number of literals.</li>
<li>Substring search for literals is often much faster (sometimes by an order
of magnitude) than a regex search.</li>
</ul>
<p>Thus, in many cases, one can search for literals to find candidate starting
locations of a match, and then only run the full regex engine at each such
location instead of over the full haystack.</p>
<p>The main downside of literal extraction is that it can wind up causing a
search to be slower overall. For example, if there are many matches or if
there are many candidates that don’t ultimately lead to a match, then a
lot of overhead will be spent in shuffing back-and-forth between substring
search and the regex engine. This is the fundamental reason why literal
optimizations for regex patterns is sometimes considered a “black art.”</p>
<h2 id="look-around-assertions"><a href="#look-around-assertions">Look-around assertions</a></h2>
<p>Literal extraction treats all look-around assertions as-if they match every
empty string. So for example, the regex <code>\bquux\b</code> will yield a sequence
containing a single exact literal <code>quux</code>. However, not all occurrences
of <code>quux</code> correspond to a match a of the regex. For example, <code>\bquux\b</code>
does not match <code>ZquuxZ</code> anywhere because <code>quux</code> does not fall on a word
boundary.</p>
<p>In effect, if your regex contains look-around assertions, then a match of
an exact literal does not necessarily mean the regex overall matches. So
you may still need to run the regex engine in such cases to confirm the
match.</p>
<p>The precise guarantee you get from a literal sequence is: if every literal
in the sequence is exact and the original regex contains zero look-around
assertions, then a preference-order multi-substring search of those
literals will precisely match a preference-order search of the original
regex.</p>
<h2 id="example"><a href="#example">Example</a></h2>
<p>This shows how to extract prefixes:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex_syntax::{hir::literal::{Extractor, Literal, Seq}, parse};
<span class="kw">let </span>hir = parse(<span class="string">r&quot;(a|b|c)(x|y|z)[A-Z]+foo&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>got = Extractor::new().extract(<span class="kw-2">&amp;</span>hir);
<span class="comment">// All literals returned are &quot;inexact&quot; because none of them reach the
// match state.
</span><span class="kw">let </span>expected = Seq::from_iter([
Literal::inexact(<span class="string">&quot;ax&quot;</span>),
Literal::inexact(<span class="string">&quot;ay&quot;</span>),
Literal::inexact(<span class="string">&quot;az&quot;</span>),
Literal::inexact(<span class="string">&quot;bx&quot;</span>),
Literal::inexact(<span class="string">&quot;by&quot;</span>),
Literal::inexact(<span class="string">&quot;bz&quot;</span>),
Literal::inexact(<span class="string">&quot;cx&quot;</span>),
Literal::inexact(<span class="string">&quot;cy&quot;</span>),
Literal::inexact(<span class="string">&quot;cz&quot;</span>),
]);
<span class="macro">assert_eq!</span>(expected, got);
</code></pre></div>
<p>This shows how to extract suffixes:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex_syntax::{
hir::literal::{Extractor, ExtractKind, Literal, Seq},
parse,
};
<span class="kw">let </span>hir = parse(<span class="string">r&quot;foo|[A-Z]+bar&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>got = Extractor::new().kind(ExtractKind::Suffix).extract(<span class="kw-2">&amp;</span>hir);
<span class="comment">// Since &#39;foo&#39; gets to a match state, it is considered exact. But &#39;bar&#39;
// does not because of the &#39;[A-Z]+&#39;, and thus is marked inexact.
</span><span class="kw">let </span>expected = Seq::from_iter([
Literal::exact(<span class="string">&quot;foo&quot;</span>),
Literal::inexact(<span class="string">&quot;bar&quot;</span>),
]);
<span class="macro">assert_eq!</span>(expected, got);
</code></pre></div>
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><div id="implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Extractor" class="impl has-srclink"><a class="srclink rightside" href="../../../src/regex_syntax/hir/literal.rs.html#155-631">source</a><a href="#impl-Extractor" class="anchor"></a><h3 class="code-header">impl <a class="struct" href="struct.Extractor.html" title="struct regex_syntax::hir::literal::Extractor">Extractor</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.new" class="method has-srclink"><a class="srclink rightside" href="../../../src/regex_syntax/hir/literal.rs.html#160-168">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fnname">new</a>() -&gt; <a class="struct" href="struct.Extractor.html" title="struct regex_syntax::hir::literal::Extractor">Extractor</a></h4></section></summary><div class="docblock"><p>Create a new extractor with a default configuration.</p>
<p>The extractor can be optionally configured before calling
<a href="struct.Extractor.html#method.extract" title="Extractor::extract"><code>Extractor::extract</code></a> to get a literal sequence.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.extract" class="method has-srclink"><a class="srclink rightside" href="../../../src/regex_syntax/hir/literal.rs.html#171-199">source</a><h4 class="code-header">pub fn <a href="#method.extract" class="fnname">extract</a>(&amp;self, hir: &amp;<a class="struct" href="../struct.Hir.html" title="struct regex_syntax::hir::Hir">Hir</a>) -&gt; <a class="struct" href="struct.Seq.html" title="struct regex_syntax::hir::literal::Seq">Seq</a></h4></section></summary><div class="docblock"><p>Execute the extractor and return a sequence of literals.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.kind" class="method has-srclink"><a class="srclink rightside" href="../../../src/regex_syntax/hir/literal.rs.html#220-223">source</a><h4 class="code-header">pub fn <a href="#method.kind" class="fnname">kind</a>(&amp;mut self, kind: <a class="enum" href="enum.ExtractKind.html" title="enum regex_syntax::hir::literal::ExtractKind">ExtractKind</a>) -&gt; &amp;mut <a class="struct" href="struct.Extractor.html" title="struct regex_syntax::hir::literal::Extractor">Extractor</a></h4></section></summary><div class="docblock"><p>Set the kind of literal sequence to extract from an <a href="../struct.Hir.html" title="Hir"><code>Hir</code></a> expression.</p>
<p>The default is to extract prefixes, but suffixes can be selected
instead. The contract for prefixes is that every match of the
corresponding <code>Hir</code> must start with one of the literals in the sequence
returned. Moreover, the <em>order</em> of the sequence returned corresponds to
the preference order.</p>
<p>Suffixes satisfy a similar contract in that every match of the
corresponding <code>Hir</code> must end with one of the literals in the sequence
returned. However, there is no guarantee that the literals are in
preference order.</p>
<p>Remember that a sequence can be infinite. For example, unless the
limits are configured to be impractically large, attempting to extract
prefixes (or suffixes) for the pattern <code>[A-Z]</code> will return an infinite
sequence. Generally speaking, if the sequence returned is infinite,
then it is presumed to be unwise to do prefix (or suffix) optimizations
for the pattern.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.limit_class" class="method has-srclink"><a class="srclink rightside" href="../../../src/regex_syntax/hir/literal.rs.html#255-258">source</a><h4 class="code-header">pub fn <a href="#method.limit_class" class="fnname">limit_class</a>(&amp;mut self, limit: usize) -&gt; &amp;mut <a class="struct" href="struct.Extractor.html" title="struct regex_syntax::hir::literal::Extractor">Extractor</a></h4></section></summary><div class="docblock"><p>Configure a limit on the length of the sequence that is permitted for
a character class. If a character class exceeds this limit, then the
sequence returned for it is infinite.</p>
<p>This prevents classes like <code>[A-Z]</code> or <code>\pL</code> from getting turned into
huge and likely unproductive sequences of literals.</p>
<h5 id="example-1"><a href="#example-1">Example</a></h5>
<p>This example shows how this limit can be lowered to decrease the tolerance
for character classes being turned into literal sequences.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex_syntax::{hir::literal::{Extractor, Seq}, parse};
<span class="kw">let </span>hir = parse(<span class="string">r&quot;[0-9]&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>got = Extractor::new().extract(<span class="kw-2">&amp;</span>hir);
<span class="kw">let </span>expected = Seq::new([
<span class="string">&quot;0&quot;</span>, <span class="string">&quot;1&quot;</span>, <span class="string">&quot;2&quot;</span>, <span class="string">&quot;3&quot;</span>, <span class="string">&quot;4&quot;</span>, <span class="string">&quot;5&quot;</span>, <span class="string">&quot;6&quot;</span>, <span class="string">&quot;7&quot;</span>, <span class="string">&quot;8&quot;</span>, <span class="string">&quot;9&quot;</span>,
]);
<span class="macro">assert_eq!</span>(expected, got);
<span class="comment">// Now let&#39;s shrink the limit and see how that changes things.
</span><span class="kw">let </span>got = Extractor::new().limit_class(<span class="number">4</span>).extract(<span class="kw-2">&amp;</span>hir);
<span class="kw">let </span>expected = Seq::infinite();
<span class="macro">assert_eq!</span>(expected, got);
</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.limit_repeat" class="method has-srclink"><a class="srclink rightside" href="../../../src/regex_syntax/hir/literal.rs.html#292-295">source</a><h4 class="code-header">pub fn <a href="#method.limit_repeat" class="fnname">limit_repeat</a>(&amp;mut self, limit: usize) -&gt; &amp;mut <a class="struct" href="struct.Extractor.html" title="struct regex_syntax::hir::literal::Extractor">Extractor</a></h4></section></summary><div class="docblock"><p>Configure a limit on the total number of repetitions that is permitted
before literal extraction is stopped.</p>
<p>This is useful for limiting things like <code>(abcde){50}</code>, or more
insidiously, <code>(?:){1000000000}</code>. This limit prevents any one single
repetition from adding too much to a literal sequence.</p>
<p>With this limit set, repetitions that exceed it will be stopped and any
literals extracted up to that point will be made inexact.</p>
<h5 id="example-2"><a href="#example-2">Example</a></h5>
<p>This shows how to decrease the limit and compares it with the default.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex_syntax::{hir::literal::{Extractor, Literal, Seq}, parse};
<span class="kw">let </span>hir = parse(<span class="string">r&quot;(abc){8}&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>got = Extractor::new().extract(<span class="kw-2">&amp;</span>hir);
<span class="kw">let </span>expected = Seq::new([<span class="string">&quot;abcabcabcabcabcabcabcabc&quot;</span>]);
<span class="macro">assert_eq!</span>(expected, got);
<span class="comment">// Now let&#39;s shrink the limit and see how that changes things.
</span><span class="kw">let </span>got = Extractor::new().limit_repeat(<span class="number">4</span>).extract(<span class="kw-2">&amp;</span>hir);
<span class="kw">let </span>expected = Seq::from_iter([
Literal::inexact(<span class="string">&quot;abcabcabcabc&quot;</span>),
]);
<span class="macro">assert_eq!</span>(expected, got);
</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.limit_literal_len" class="method has-srclink"><a class="srclink rightside" href="../../../src/regex_syntax/hir/literal.rs.html#329-332">source</a><h4 class="code-header">pub fn <a href="#method.limit_literal_len" class="fnname">limit_literal_len</a>(&amp;mut self, limit: usize) -&gt; &amp;mut <a class="struct" href="struct.Extractor.html" title="struct regex_syntax::hir::literal::Extractor">Extractor</a></h4></section></summary><div class="docblock"><p>Configure a limit on the maximum length of any literal in a sequence.</p>
<p>This is useful for limiting things like <code>(abcde){5}{5}{5}{5}</code>. While
each repetition or literal in that regex is small, when all the
repetitions are applied, one ends up with a literal of length <code>5^4 = 625</code>.</p>
<p>With this limit set, literals that exceed it will be made inexact and
thus prevented from growing.</p>
<h5 id="example-3"><a href="#example-3">Example</a></h5>
<p>This shows how to decrease the limit and compares it with the default.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex_syntax::{hir::literal::{Extractor, Literal, Seq}, parse};
<span class="kw">let </span>hir = parse(<span class="string">r&quot;(abc){2}{2}{2}&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>got = Extractor::new().extract(<span class="kw-2">&amp;</span>hir);
<span class="kw">let </span>expected = Seq::new([<span class="string">&quot;abcabcabcabcabcabcabcabc&quot;</span>]);
<span class="macro">assert_eq!</span>(expected, got);
<span class="comment">// Now let&#39;s shrink the limit and see how that changes things.
</span><span class="kw">let </span>got = Extractor::new().limit_literal_len(<span class="number">14</span>).extract(<span class="kw-2">&amp;</span>hir);
<span class="kw">let </span>expected = Seq::from_iter([
Literal::inexact(<span class="string">&quot;abcabcabcabcab&quot;</span>),
]);
<span class="macro">assert_eq!</span>(expected, got);
</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.limit_total" class="method has-srclink"><a class="srclink rightside" href="../../../src/regex_syntax/hir/literal.rs.html#385-388">source</a><h4 class="code-header">pub fn <a href="#method.limit_total" class="fnname">limit_total</a>(&amp;mut self, limit: usize) -&gt; &amp;mut <a class="struct" href="struct.Extractor.html" title="struct regex_syntax::hir::literal::Extractor">Extractor</a></h4></section></summary><div class="docblock"><p>Configure a limit on the total number of literals that will be
returned.</p>
<p>This is useful as a practical measure for avoiding the creation of
large sequences of literals. While the extractor will automatically
handle local creations of large sequences (for example, <code>[A-Z]</code> yields
an infinite sequence by default), large sequences can be created
through non-local means as well.</p>
<p>For example, <code>[ab]{3}{3}</code> would yield a sequence of length <code>512 = 2^9</code>
despite each of the repetitions being small on their own. This limit
thus represents a “catch all” for avoiding locally small sequences from
combining into large sequences.</p>
<h5 id="example-4"><a href="#example-4">Example</a></h5>
<p>This example shows how reducing the limit will change the literal
sequence returned.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex_syntax::{hir::literal::{Extractor, Literal, Seq}, parse};
<span class="kw">let </span>hir = parse(<span class="string">r&quot;[ab]{2}{2}&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>got = Extractor::new().extract(<span class="kw-2">&amp;</span>hir);
<span class="kw">let </span>expected = Seq::new([
<span class="string">&quot;aaaa&quot;</span>, <span class="string">&quot;aaab&quot;</span>, <span class="string">&quot;aaba&quot;</span>, <span class="string">&quot;aabb&quot;</span>,
<span class="string">&quot;abaa&quot;</span>, <span class="string">&quot;abab&quot;</span>, <span class="string">&quot;abba&quot;</span>, <span class="string">&quot;abbb&quot;</span>,
<span class="string">&quot;baaa&quot;</span>, <span class="string">&quot;baab&quot;</span>, <span class="string">&quot;baba&quot;</span>, <span class="string">&quot;babb&quot;</span>,
<span class="string">&quot;bbaa&quot;</span>, <span class="string">&quot;bbab&quot;</span>, <span class="string">&quot;bbba&quot;</span>, <span class="string">&quot;bbbb&quot;</span>,
]);
<span class="macro">assert_eq!</span>(expected, got);
<span class="comment">// The default limit is not too big, but big enough to extract all
// literals from &#39;[ab]{2}{2}&#39;. If we shrink the limit to less than 16,
// then we&#39;ll get a truncated set. Notice that it returns a sequence of
// length 4 even though our limit was 10. This is because the sequence
// is difficult to increase without blowing the limit. Notice also
// that every literal in the sequence is now inexact because they were
// stripped of some suffix.
</span><span class="kw">let </span>got = Extractor::new().limit_total(<span class="number">10</span>).extract(<span class="kw-2">&amp;</span>hir);
<span class="kw">let </span>expected = Seq::from_iter([
Literal::inexact(<span class="string">&quot;aa&quot;</span>),
Literal::inexact(<span class="string">&quot;ab&quot;</span>),
Literal::inexact(<span class="string">&quot;ba&quot;</span>),
Literal::inexact(<span class="string">&quot;bb&quot;</span>),
]);
<span class="macro">assert_eq!</span>(expected, got);
</code></pre></div>
</div></details></div></details></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Clone-for-Extractor" class="impl has-srclink"><a class="srclink rightside" href="../../../src/regex_syntax/hir/literal.rs.html#146">source</a><a href="#impl-Clone-for-Extractor" class="anchor"></a><h3 class="code-header">impl Clone for <a class="struct" href="struct.Extractor.html" title="struct regex_syntax::hir::literal::Extractor">Extractor</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/regex_syntax/hir/literal.rs.html#146">source</a><a href="#method.clone" class="anchor"></a><h4 class="code-header">fn <a class="fnname">clone</a>(&amp;self) -&gt; <a class="struct" href="struct.Extractor.html" title="struct regex_syntax::hir::literal::Extractor">Extractor</a></h4></section></summary><div class='docblock'>Returns a copy of the value. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.clone_from" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">clone_from</a>(&amp;mut self, source: &amp;Self)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Debug-for-Extractor" class="impl has-srclink"><a class="srclink rightside" href="../../../src/regex_syntax/hir/literal.rs.html#146">source</a><a href="#impl-Debug-for-Extractor" class="anchor"></a><h3 class="code-header">impl Debug for <a class="struct" href="struct.Extractor.html" title="struct regex_syntax::hir::literal::Extractor">Extractor</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/regex_syntax/hir/literal.rs.html#146">source</a><a href="#method.fmt" class="anchor"></a><h4 class="code-header">fn <a class="fnname">fmt</a>(&amp;self, f: &amp;mut Formatter&lt;'_&gt;) -&gt; Result</h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Default-for-Extractor" class="impl has-srclink"><a class="srclink rightside" href="../../../src/regex_syntax/hir/literal.rs.html#633-637">source</a><a href="#impl-Default-for-Extractor" class="anchor"></a><h3 class="code-header">impl Default for <a class="struct" href="struct.Extractor.html" title="struct regex_syntax::hir::literal::Extractor">Extractor</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.default" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/regex_syntax/hir/literal.rs.html#634-636">source</a><a href="#method.default" class="anchor"></a><h4 class="code-header">fn <a class="fnname">default</a>() -&gt; <a class="struct" href="struct.Extractor.html" title="struct regex_syntax::hir::literal::Extractor">Extractor</a></h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a>Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-Extractor" class="impl has-srclink"><a href="#impl-RefUnwindSafe-for-Extractor" class="anchor"></a><h3 class="code-header">impl RefUnwindSafe for <a class="struct" href="struct.Extractor.html" title="struct regex_syntax::hir::literal::Extractor">Extractor</a></h3></section><section id="impl-Send-for-Extractor" class="impl has-srclink"><a href="#impl-Send-for-Extractor" class="anchor"></a><h3 class="code-header">impl Send for <a class="struct" href="struct.Extractor.html" title="struct regex_syntax::hir::literal::Extractor">Extractor</a></h3></section><section id="impl-Sync-for-Extractor" class="impl has-srclink"><a href="#impl-Sync-for-Extractor" class="anchor"></a><h3 class="code-header">impl Sync for <a class="struct" href="struct.Extractor.html" title="struct regex_syntax::hir::literal::Extractor">Extractor</a></h3></section><section id="impl-Unpin-for-Extractor" class="impl has-srclink"><a href="#impl-Unpin-for-Extractor" class="anchor"></a><h3 class="code-header">impl Unpin for <a class="struct" href="struct.Extractor.html" title="struct regex_syntax::hir::literal::Extractor">Extractor</a></h3></section><section id="impl-UnwindSafe-for-Extractor" class="impl has-srclink"><a href="#impl-UnwindSafe-for-Extractor" class="anchor"></a><h3 class="code-header">impl UnwindSafe for <a class="struct" href="struct.Extractor.html" title="struct regex_syntax::hir::literal::Extractor">Extractor</a></h3></section></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Any-for-Extractor" class="impl has-srclink"><a href="#impl-Any-for-Extractor" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; Any for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl has-srclink"><a href="#method.type_id" class="anchor"></a><h4 class="code-header">fn <a class="fnname">type_id</a>(&amp;self) -&gt; TypeId</h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-Extractor" class="impl has-srclink"><a href="#impl-Borrow%3CT%3E-for-Extractor" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; Borrow&lt;T&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span><a href="#method.borrow" class="anchor"></a><h4 class="code-header">fn <a class="fnname">borrow</a>(&amp;self) -&gt; &amp;T</h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-Extractor" class="impl has-srclink"><a href="#impl-BorrowMut%3CT%3E-for-Extractor" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; BorrowMut&lt;T&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">fn <a class="fnname">borrow_mut</a>(&amp;mut self) -&gt; &amp;mut T</h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-Extractor" class="impl has-srclink"><a href="#impl-From%3CT%3E-for-Extractor" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; From&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.from" class="anchor"></a><h4 class="code-header">fn <a class="fnname">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-Extractor" class="impl has-srclink"><a href="#impl-Into%3CU%3E-for-Extractor" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; Into&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: From&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">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>[From]&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ToOwned-for-Extractor" class="impl has-srclink"><a href="#impl-ToOwned-for-Extractor" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; ToOwned for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: Clone,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Owned" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl has-srclink"><a href="#method.to_owned" class="anchor"></a><h4 class="code-header">fn <a class="fnname">to_owned</a>(&amp;self) -&gt; T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl has-srclink"><a href="#method.clone_into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">clone_into</a>(&amp;self, target: &amp;mut T)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-Extractor" class="impl has-srclink"><a href="#impl-TryFrom%3CU%3E-for-Extractor" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; TryFrom&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: Into&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = Infallible</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.try_from" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_from</a>(value: U) -&gt; Result&lt;T, &lt;T as TryFrom&lt;U&gt;&gt;::Error&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-Extractor" class="impl has-srclink"><a href="#impl-TryInto%3CU%3E-for-Extractor" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; TryInto&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: TryFrom&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = &lt;U as TryFrom&lt;T&gt;&gt;::Error</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.try_into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_into</a>(self) -&gt; Result&lt;U, &lt;U as TryFrom&lt;T&gt;&gt;::Error&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="regex_syntax" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>