| <!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">☰</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<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-Extractor">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-Extractor">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-Extractor">Into<U></a></li><li><a href="#impl-ToOwned-for-Extractor">ToOwned</a></li><li><a href="#impl-TryFrom%3CU%3E-for-Extractor">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-Extractor">TryInto<U></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">−</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"(a|b|c)(x|y|z)[A-Z]+foo"</span>)<span class="question-mark">?</span>; |
| <span class="kw">let </span>got = Extractor::new().extract(<span class="kw-2">&</span>hir); |
| <span class="comment">// All literals returned are "inexact" because none of them reach the |
| // match state. |
| </span><span class="kw">let </span>expected = Seq::from_iter([ |
| Literal::inexact(<span class="string">"ax"</span>), |
| Literal::inexact(<span class="string">"ay"</span>), |
| Literal::inexact(<span class="string">"az"</span>), |
| Literal::inexact(<span class="string">"bx"</span>), |
| Literal::inexact(<span class="string">"by"</span>), |
| Literal::inexact(<span class="string">"bz"</span>), |
| Literal::inexact(<span class="string">"cx"</span>), |
| Literal::inexact(<span class="string">"cy"</span>), |
| Literal::inexact(<span class="string">"cz"</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"foo|[A-Z]+bar"</span>)<span class="question-mark">?</span>; |
| <span class="kw">let </span>got = Extractor::new().kind(ExtractKind::Suffix).extract(<span class="kw-2">&</span>hir); |
| <span class="comment">// Since 'foo' gets to a match state, it is considered exact. But 'bar' |
| // does not because of the '[A-Z]+', and thus is marked inexact. |
| </span><span class="kw">let </span>expected = Seq::from_iter([ |
| Literal::exact(<span class="string">"foo"</span>), |
| Literal::inexact(<span class="string">"bar"</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>() -> <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>(&self, hir: &<a class="struct" href="../struct.Hir.html" title="struct regex_syntax::hir::Hir">Hir</a>) -> <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>(&mut self, kind: <a class="enum" href="enum.ExtractKind.html" title="enum regex_syntax::hir::literal::ExtractKind">ExtractKind</a>) -> &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>(&mut self, limit: usize) -> &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"[0-9]"</span>)<span class="question-mark">?</span>; |
| |
| <span class="kw">let </span>got = Extractor::new().extract(<span class="kw-2">&</span>hir); |
| <span class="kw">let </span>expected = Seq::new([ |
| <span class="string">"0"</span>, <span class="string">"1"</span>, <span class="string">"2"</span>, <span class="string">"3"</span>, <span class="string">"4"</span>, <span class="string">"5"</span>, <span class="string">"6"</span>, <span class="string">"7"</span>, <span class="string">"8"</span>, <span class="string">"9"</span>, |
| ]); |
| <span class="macro">assert_eq!</span>(expected, got); |
| |
| <span class="comment">// Now let'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">&</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>(&mut self, limit: usize) -> &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"(abc){8}"</span>)<span class="question-mark">?</span>; |
| |
| <span class="kw">let </span>got = Extractor::new().extract(<span class="kw-2">&</span>hir); |
| <span class="kw">let </span>expected = Seq::new([<span class="string">"abcabcabcabcabcabcabcabc"</span>]); |
| <span class="macro">assert_eq!</span>(expected, got); |
| |
| <span class="comment">// Now let'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">&</span>hir); |
| <span class="kw">let </span>expected = Seq::from_iter([ |
| Literal::inexact(<span class="string">"abcabcabcabc"</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>(&mut self, limit: usize) -> &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"(abc){2}{2}{2}"</span>)<span class="question-mark">?</span>; |
| |
| <span class="kw">let </span>got = Extractor::new().extract(<span class="kw-2">&</span>hir); |
| <span class="kw">let </span>expected = Seq::new([<span class="string">"abcabcabcabcabcabcabcabc"</span>]); |
| <span class="macro">assert_eq!</span>(expected, got); |
| |
| <span class="comment">// Now let'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">&</span>hir); |
| <span class="kw">let </span>expected = Seq::from_iter([ |
| Literal::inexact(<span class="string">"abcabcabcabcab"</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>(&mut self, limit: usize) -> &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"[ab]{2}{2}"</span>)<span class="question-mark">?</span>; |
| |
| <span class="kw">let </span>got = Extractor::new().extract(<span class="kw-2">&</span>hir); |
| <span class="kw">let </span>expected = Seq::new([ |
| <span class="string">"aaaa"</span>, <span class="string">"aaab"</span>, <span class="string">"aaba"</span>, <span class="string">"aabb"</span>, |
| <span class="string">"abaa"</span>, <span class="string">"abab"</span>, <span class="string">"abba"</span>, <span class="string">"abbb"</span>, |
| <span class="string">"baaa"</span>, <span class="string">"baab"</span>, <span class="string">"baba"</span>, <span class="string">"babb"</span>, |
| <span class="string">"bbaa"</span>, <span class="string">"bbab"</span>, <span class="string">"bbba"</span>, <span class="string">"bbbb"</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 '[ab]{2}{2}'. If we shrink the limit to less than 16, |
| // then we'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">&</span>hir); |
| <span class="kw">let </span>expected = Seq::from_iter([ |
| Literal::inexact(<span class="string">"aa"</span>), |
| Literal::inexact(<span class="string">"ab"</span>), |
| Literal::inexact(<span class="string">"ba"</span>), |
| Literal::inexact(<span class="string">"bb"</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>(&self) -> <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>(&mut self, source: &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>(&self, f: &mut Formatter<'_>) -> 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>() -> <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<T> Any for T<span class="where fmt-newline">where<br> 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>(&self) -> 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<T> Borrow<T> for T<span class="where fmt-newline">where<br> 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>(&self) -> &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<T> BorrowMut<T> for T<span class="where fmt-newline">where<br> 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>(&mut self) -> &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<T> From<T> 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) -> 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<T, U> Into<U> for T<span class="where fmt-newline">where<br> U: From<T>,</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) -> 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]<T> 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<T> ToOwned for T<span class="where fmt-newline">where<br> 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>(&self) -> 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>(&self, target: &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<T, U> TryFrom<U> for T<span class="where fmt-newline">where<br> U: Into<T>,</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) -> Result<T, <T as TryFrom<U>>::Error></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<T, U> TryInto<U> for T<span class="where fmt-newline">where<br> U: TryFrom<T>,</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> = <U as TryFrom<T>>::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) -> Result<U, <U as TryFrom<T>>::Error></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> |