<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><metaname="generator"content="rustdoc"><metaname="description"content="The configuration used for building a lazy DFA."><title>Config in regex_automata::hybrid::dfa - Rust</title><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><linkrel="stylesheet"href="../../../static.files/normalize-76eba96aa4d2e634.css"><linkrel="stylesheet"href="../../../static.files/rustdoc-5bc39a1768837dd0.css"><metaname="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"><scriptsrc="../../../static.files/storage-4c98445ec4002617.js"></script><scriptdefersrc="sidebar-items.js"></script><scriptdefersrc="../../../static.files/main-48f368f3872407c8.js"></script><noscript><linkrel="stylesheet"href="../../../static.files/noscript-04d5337699b92874.css"></noscript><linkrel="alternate icon"type="image/png"href="../../../static.files/favicon-16x16-8b506e7a72182f1c.png"><linkrel="alternate icon"type="image/png"href="../../../static.files/favicon-32x32-422f7d1d52889060.png"><linkrel="icon"type="image/svg+xml"href="../../../static.files/favicon-2c020d218678b618.svg"></head><bodyclass="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="mobile-topbar"><buttonclass="sidebar-menu-toggle"title="show sidebar"></button></nav><navclass="sidebar"><divclass="sidebar-crate"><h2><ahref="../../../regex_automata/index.html">regex_automata</a><spanclass="version">0.4.6</span></h2></div><h2class="location"><ahref="#">Config</a></h2><divclass="sidebar-elems"><section><h3><ahref="#implementations">Methods</a></h3><ulclass="block method"><li><ahref="#method.byte_classes">byte_classes</a></li><li><ahref="#method.cache_capacity">cache_capacity</a></li><li><ahref="#method.get_byte_classes">get_byte_classes</a></li><li><ahref="#method.get_cache_capacity">get_cache_capacity</a></li><li><ahref="#method.get_match_kind">get_match_kind</a></li><li><ahref="#method.get_minimum_bytes_per_state">get_minimum_bytes_per_state</a></li><li><ahref="#method.get_minimum_cache_capacity">get_minimum_cache_capacity</a></li><li><ahref="#method.get_minimum_cache_clear_count">get_minimum_cache_clear_count</a></li><li><ahref="#method.get_prefilter">get_prefilter</a></li><li><ahref="#method.get_quit">get_quit</a></li><li><ahref="#method.get_skip_cache_capacity_check">get_skip_cache_capacity_check</a></li><li><ahref="#method.get_specialize_start_states">get_specialize_start_states</a></li><li><ahref="#method.get_starts_for_each_pattern">get_starts_for_each_pattern</a></li><li><ahref="#method.get_unicode_word_boundary">get_unicode_word_boundary</a></li><li><ahref="#method.match_kind">match_kind</a></li><li><ahref="#method.minimum_bytes_per_state">minimum_bytes_per_state</a></li><li><ahref="#method.minimum_cache_clear_count">minimum_cache_clear_count</a></li><li><ahref="#method.new">new</a></li><li><ahref="#method.prefilter">prefilter</a></li><li><ahref="#method.quit">quit</a></li><li><ahref="#method.skip_cache_capacity_check">skip_c
<main><divclass="width-limiter"><navclass="sub"><formclass="search-form"><span></span><divid="sidebar-button"tabindex="-1"><ahref="../../../regex_automata/all.html"title="show sidebar"></a></div><inputclass="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"><divid="help-button"tabindex="-1"><ahref="../../../help.html"title="help">?</a></div><divid="settings-menu"tabindex="-1"><ahref="../../../settings.html"title="settings"><imgwidth="22"height="22"alt="Change settings"src="../../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><sectionid="main-content"class="content"><divclass="main-heading"><h1>Struct <ahref="../../index.html">regex_automata</a>::<wbr><ahref="../index.html">hybrid</a>::<wbr><ahref="index.html">dfa</a>::<wbr><aclass="struct"href="#">Config</a><buttonid="copy-path"title="Copy item path to clipboard"><imgsrc="../../../static.files/clipboard-7571035ce49a181d.svg"width="19"height="18"alt="Copy item path"></button></h1><spanclass="out-of-band"><aclass="src"href="../../../src/regex_automata/hybrid/dfa.rs.html#2863-2882">source</a> · <buttonid="toggle-all-docs"title="collapse all docs">[<span>−</span>]</button></span></div><preclass="rust item-decl"><code>pub struct Config { <spanclass="comment">/* private fields */</span> }</code></pre><detailsclass="toggle top-doc"open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>The configuration used for building a lazy DFA.</p>
<p>As a convenience, <ahref="struct.DFA.html#method.config"title="associated function regex_automata::hybrid::dfa::DFA::config"><code>DFA::config</code></a> is an alias for <ahref="struct.Config.html#method.new"title="associated function regex_automata::hybrid::dfa::Config::new"><code>Config::new</code></a>. The
advantage of the former is that it often lets you avoid importing the
<code>Config</code> type directly.</p>
<p>A lazy DFA configuration is a simple data object that is typically used
with <ahref="struct.Builder.html#method.configure"title="method regex_automata::hybrid::dfa::Builder::configure"><code>Builder::configure</code></a>.</p>
<p>The default configuration guarantees that a search will never return a
“gave up” or “quit” error, although it is possible for a search to fail
if <ahref="struct.Config.html#method.starts_for_each_pattern"title="method regex_automata::hybrid::dfa::Config::starts_for_each_pattern"><code>Config::starts_for_each_pattern</code></a> wasn’t enabled (which it is not by
default) and an <ahref="../../enum.Anchored.html#variant.Pattern"title="variant regex_automata::Anchored::Pattern"><code>Anchored::Pattern</code></a> mode is requested via <ahref="../../struct.Input.html"title="struct regex_automata::Input"><code>Input</code></a>.</p>
</div></details><h2id="implementations"class="section-header">Implementations<ahref="#implementations"class="anchor">§</a></h2><divid="implementations-list"><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Config"class="impl"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#2884-3906">source</a><ahref="#impl-Config"class="anchor">§</a><h3class="code-header">impl <aclass="struct"href="struct.Config.html"title="struct regex_automata::hybrid::dfa::Config">Config</a></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.new"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#2886-2888">source</a><h4class="code-header">pub fn <ahref="#method.new"class="fn">new</a>() -><aclass="struct"href="struct.Config.html"title="struct regex_automata::hybrid::dfa::Config">Config</a></h4></section></summary><divclass="docblock"><p>Return a new default lazy DFA builder configuration.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.match_kind"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#2998-3001">source</a><h4class="code-header">pub fn <ahref="#method.match_kind"class="fn">match_kind</a>(self, kind: <aclass="enum"href="../../enum.MatchKind.html"title="enum regex_automata::MatchKind">MatchKind</a>) -><aclass="struct"href="struct.Config.html"title="struct regex_automata::hybrid::dfa::Config">Config</a></h4></section></summary><divclass="docblock"><p>Set the desired match semantics.</p>
<p>The default is <ahref="../../enum.MatchKind.html#variant.LeftmostFirst"title="variant regex_automata::MatchKind::LeftmostFirst"><code>MatchKind::LeftmostFirst</code></a>, which corresponds to the
match semantics of Perl-like regex engines. That is, when multiple
patterns would match at the same leftmost position, the pattern that
appears first in the concrete syntax is chosen.</p>
<p>Currently, the only other kind of match semantics supported is
<ahref="../../enum.MatchKind.html#variant.All"title="variant regex_automata::MatchKind::All"><code>MatchKind::All</code></a>. This corresponds to classical DFA construction
where all possible matches are added to the lazy DFA.</p>
<p>Typically, <code>All</code> is used when one wants to execute an overlapping
search and <code>LeftmostFirst</code> otherwise. In particular, it rarely makes
sense to use <code>All</code> with the various “leftmost” find routines, since the
leftmost routines depend on the <code>LeftmostFirst</code> automata construction
strategy. Specifically, <code>LeftmostFirst</code> adds dead states to the
lazy DFA as a way to terminate the search and report a match.
<code>LeftmostFirst</code> also supports non-greedy matches using this strategy
<h5id="example-reverse-automaton-to-find-start-of-match"><aclass="doc-anchor"href="#example-reverse-automaton-to-find-start-of-match">§</a>Example: reverse automaton to find start of match</h5>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.prefilter"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#3074-3081">source</a><h4class="code-header">pub fn <ahref="#method.prefilter"class="fn">prefilter</a>(self, pre: <aclass="enum"href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="../../util/prefilter/struct.Prefilter.html"title="struct regex_automata::util::prefilter::Prefilter">Prefilter</a>>) -><aclass="struct"href="struct.Config.html"title="struct regex_automata::hybrid::dfa::Config">Config</a></h4></section></summary><divclass="docblock"><p>Set a prefilter to be used whenever a start state is entered.</p>
<p>A <ahref="../../util/prefilter/struct.Prefilter.html"title="struct regex_automata::util::prefilter::Prefilter"><code>Prefilter</code></a> in this context is meant to accelerate searches by
looking for literal prefixes that every match for the corresponding
pattern (or patterns) must start with. Once a prefilter produces a
match, the underlying search routine continues on to try and confirm
the match.</p>
<p>Be warned that setting a prefilter does not guarantee that the search
will be faster. While it’s usually a good bet, if the prefilter
produces a lot of false positive candidates (i.e., positions matched
by the prefilter but not by the regex), then the overall result can
be slower than if you had just executed the regex engine without any
prefilters.</p>
<p>Note that unless <ahref="struct.Config.html#method.specialize_start_states"title="method regex_automata::hybrid::dfa::Config::specialize_start_states"><code>Config::specialize_start_states</code></a> has been
explicitly set, then setting this will also enable (when <code>pre</code> is
<code>Some</code>) or disable (when <code>pre</code> is <code>None</code>) start state specialization.
This occurs because without start state specialization, a prefilter
is likely to be less effective. And without a prefilter, start state
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.starts_for_each_pattern"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#3153-3156">source</a><h4class="code-header">pub fn <ahref="#method.starts_for_each_pattern"class="fn">starts_for_each_pattern</a>(self, yes: <aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a>) -><aclass="struct"href="struct.Config.html"title="struct regex_automata::hybrid::dfa::Config">Config</a></h4></section></summary><divclass="docblock"><p>Whether to compile a separate start state for each pattern in the
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.byte_classes"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#3189-3192">source</a><h4class="code-header">pub fn <ahref="#method.byte_classes"class="fn">byte_classes</a>(self, yes: <aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a>) -><aclass="struct"href="struct.Config.html"title="struct regex_automata::hybrid::dfa::Config">Config</a></h4></section></summary><divclass="docblock"><p>Whether to attempt to shrink the size of the lazy DFA’s alphabet or
<p>When set, this will attempt to implement Unicode word boundaries as if
they were ASCII word boundaries. This only works when the search input
is ASCII only. If a non-ASCII byte is observed while searching, then a
<ahref="../../struct.MatchError.html#method.quit"title="associated function regex_automata::MatchError::quit"><code>MatchError::quit</code></a> error is returned.</p>
<p>A possible alternative to enabling this option is to simply use an
ASCII word boundary, e.g., via <code>(?-u:\b)</code>. The main reason to use this
option is if you absolutely need Unicode support. This option lets one
use a fast search implementation (a DFA) for some potentially very
common cases, while providing the option to fall back to some other
regex engine to handle the general case when an error is returned.</p>
<p>If the pattern provided has no Unicode word boundary in it, then this
option has no effect. (That is, quitting on a non-ASCII byte only
occurs when this option is enabled <em>and</em> a Unicode word boundary is
present in the pattern.)</p>
<p>This is almost equivalent to setting all non-ASCII bytes to be quit
bytes. The only difference is that this will cause non-ASCII bytes to
be quit bytes <em>only</em> when a Unicode word boundary is present in the
pattern.</p>
<p>When enabling this option, callers <em>must</em> be prepared to
handle a <ahref="../../struct.MatchError.html"title="struct regex_automata::MatchError"><code>MatchError</code></a> error during search. When using a
<ahref="../regex/struct.Regex.html"title="struct regex_automata::hybrid::regex::Regex"><code>Regex</code></a>, this corresponds to using the
<code>try_</code> suite of methods. Alternatively, if callers can guarantee that
their input is ASCII only, then a <ahref="../../struct.MatchError.html#method.quit"title="associated function regex_automata::MatchError::quit"><code>MatchError::quit</code></a> error will never
<p>When a quit byte is seen during search time, then search will return a
<ahref="../../struct.MatchError.html#method.quit"title="associated function regex_automata::MatchError::quit"><code>MatchError::quit</code></a> error indicating the offset at which the search
stopped.</p>
<p>A quit byte will always overrule any other aspects of a regex. For
example, if the <code>x</code> byte is added as a quit byte and the regex <code>\w</code> is
used, then observing <code>x</code> will cause the search to quit immediately
despite the fact that <code>x</code> is in the <code>\w</code> class.</p>
<p>This mechanism is primarily useful for heuristically enabling certain
features like Unicode word boundaries in a DFA. Namely, if the input
to search is ASCII, then a Unicode word boundary can be implemented
via an ASCII word boundary with no change in semantics. Thus, a DFA
can attempt to match a Unicode word boundary but give up as soon as it
observes a non-ASCII byte. Indeed, if callers set all non-ASCII bytes
to be quit bytes, then Unicode word boundaries will be permitted when
building lazy DFAs. Of course, callers should enable
<ahref="struct.Config.html#method.unicode_word_boundary"title="method regex_automata::hybrid::dfa::Config::unicode_word_boundary"><code>Config::unicode_word_boundary</code></a> if they want this behavior instead.
(The advantage being that non-ASCII quit bytes will only be added if a
Unicode word boundary is in the pattern.)</p>
<p>When enabling this option, callers <em>must</em> be prepared to
handle a <ahref="../../struct.MatchError.html"title="struct regex_automata::MatchError"><code>MatchError</code></a> error during search. When using a
<ahref="../regex/struct.Regex.html"title="struct regex_automata::hybrid::regex::Regex"><code>Regex</code></a>, this corresponds to using the
<p>When start states are specialized, an implementor of a search routine
using a lazy DFA can tell when the search has entered a starting state.
When start states aren’t specialized, then it is impossible to know
whether the search has entered a start state.</p>
<p>Ideally, this option wouldn’t need to exist and we could always
specialize start states. The problem is that start states can be quite
active. This in turn means that an efficient search routine is likely
to ping-pong between a heavily optimized hot loop that handles most
states and to a less optimized specialized handling of start states.
This causes branches to get heavily mispredicted and overall can
materially decrease throughput. Therefore, specializing start states
should only be enabled when it is needed.</p>
<p>Knowing whether a search is in a start state is typically useful when a
prefilter is active for the search. A prefilter is typically only run
when in a start state and a prefilter can greatly accelerate a search.
Therefore, the possible cost of specializing start states is worth it
in this case. Otherwise, if you have no prefilter, there is likely no
reason to specialize start states.</p>
<p>This is disabled by default, but note that it is automatically
enabled (or disabled) if <ahref="struct.Config.html#method.prefilter"title="method regex_automata::hybrid::dfa::Config::prefilter"><code>Config::prefilter</code></a> is set. Namely, unless
<code>specialize_start_states</code> has already been set, <ahref="struct.Config.html#method.prefilter"title="method regex_automata::hybrid::dfa::Config::prefilter"><code>Config::prefilter</code></a>
will automatically enable or disable it based on whether a prefilter
is present or not, respectively. This is done because a prefilter’s
effectiveness is rooted in being executed whenever the DFA is in a
start state, and that’s only possible to do when they are specialized.</p>
<p>Note that it is plausibly reasonable to <em>disable</em> this option
explicitly while <em>enabling</em> a prefilter. In that case, a prefilter
will still be run at the beginning of a search, but never again. This
in theory could strike a good balance if you’re in a situation where a
prefilter is likely to produce many false positive candidates.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.cache_capacity"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#3506-3509">source</a><h4class="code-header">pub fn <ahref="#method.cache_capacity"class="fn">cache_capacity</a>(self, bytes: <aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>) -><aclass="struct"href="struct.Config.html"title="struct regex_automata::hybrid::dfa::Config">Config</a></h4></section></summary><divclass="docblock"><p>Sets the maximum amount of heap memory, in bytes, to allocate to the
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.skip_cache_capacity_check"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#3561-3564">source</a><h4class="code-header">pub fn <ahref="#method.skip_cache_capacity_check"class="fn">skip_cache_capacity_check</a>(self, yes: <aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a>) -><aclass="struct"href="struct.Config.html"title="struct regex_automata::hybrid::dfa::Config">Config</a></h4></section></summary><divclass="docblock"><p>Configures construction of a lazy DFA to use the minimum cache capacity
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.minimum_cache_clear_count"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#3665-3668">source</a><h4class="code-header">pub fn <ahref="#method.minimum_cache_clear_count"class="fn">minimum_cache_clear_count</a>(self, min: <aclass="enum"href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>) -><aclass="struct"href="struct.Config.html"title="struct regex_automata::hybrid::dfa::Config">Config</a></h4></section></summary><divclass="docblock"><p>Configure a lazy DFA search to quit after a certain number of cache
<p>When a minimum is set, then a lazy DFA search will <em>possibly</em> “give
up” after the minimum number of cache clearings has occurred. This is
typically useful in scenarios where callers want to detect whether the
lazy DFA search is “efficient” or not. If the cache is cleared too many
times, this is a good indicator that it is not efficient, and thus, the
caller may wish to use some other regex engine.</p>
<p>Note that the number of times a cache is cleared is a property of
the cache itself. Thus, if a cache is used in a subsequent search
with a similarly configured lazy DFA, then it could cause the
search to “give up” if the cache needed to be cleared, depending
on its internal count and configured minimum. The cache clear
count can only be reset to <code>0</code> via <ahref="struct.DFA.html#method.reset_cache"title="method regex_automata::hybrid::dfa::DFA::reset_cache"><code>DFA::reset_cache</code></a> (or
<ahref="../regex/struct.Regex.html#method.reset_cache"title="method regex_automata::hybrid::regex::Regex::reset_cache"><code>Regex::reset_cache</code></a> if
you’re using the <code>Regex</code> API).</p>
<p>By default, no minimum is configured. Thus, a lazy DFA search will
never give up due to cache clearings. If you do set this option, you
might consider also setting <ahref="struct.Config.html#method.minimum_bytes_per_state"title="method regex_automata::hybrid::dfa::Config::minimum_bytes_per_state"><code>Config::minimum_bytes_per_state</code></a> in
order for the lazy DFA to take efficiency into account before giving
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.minimum_bytes_per_state"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#3709-3712">source</a><h4class="code-header">pub fn <ahref="#method.minimum_bytes_per_state"class="fn">minimum_bytes_per_state</a>(self, min: <aclass="enum"href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>) -><aclass="struct"href="struct.Config.html"title="struct regex_automata::hybrid::dfa::Config">Config</a></h4></section></summary><divclass="docblock"><p>Configure a lazy DFA search to quit only when its efficiency drops
<p>The efficiency of the cache is determined by the number of DFA states
compiled per byte of haystack searched. For example, if the efficiency
is 2, then it means the lazy DFA is creating a new DFA state after
searching approximately 2 bytes in a haystack. Generally speaking, 2
is quite bad and it’s likely that even a slower regex engine like the
<ahref="../../nfa/thompson/pikevm/struct.PikeVM.html"title="struct regex_automata::nfa::thompson::pikevm::PikeVM"><code>PikeVM</code></a> would be faster.</p>
<p>This has no effect if <ahref="struct.Config.html#method.minimum_cache_clear_count"title="method regex_automata::hybrid::dfa::Config::minimum_cache_clear_count"><code>Config::minimum_cache_clear_count</code></a> is not set.
Namely, this option only kicks in when the cache has been cleared more
than the minimum number. If no minimum is set, then the cache is simply
cleared whenever it fills up and it is impossible for the lazy DFA to
quit due to ineffective use of the cache.</p>
<p>In general, if one is setting <ahref="struct.Config.html#method.minimum_cache_clear_count"title="method regex_automata::hybrid::dfa::Config::minimum_cache_clear_count"><code>Config::minimum_cache_clear_count</code></a>,
then one should probably also set this knob as well. The reason is
that the absolute number of times the cache is cleared is generally
not a great predictor of efficiency. For example, if a new DFA state
is created for every 1,000 bytes searched, then it wouldn’t be hard
for the cache to get cleared more than <code>N</code> times and then cause the
lazy DFA to quit. But a new DFA state every 1,000 bytes is likely quite
good from a performance perspective, and it’s likely that the lazy
DFA should continue searching, even if it requires clearing the cache
occasionally.</p>
<p>Finally, note that if you’re implementing your own lazy DFA search
routine and also want this efficiency check to work correctly, then
you’ll need to use the following routines to record search progress:</p>
<ul>
<li>Call <ahref="struct.Cache.html#method.search_start"title="method regex_automata::hybrid::dfa::Cache::search_start"><code>Cache::search_start</code></a> at the beginning of every search.</li>
<li>Call <ahref="struct.Cache.html#method.search_update"title="method regex_automata::hybrid::dfa::Cache::search_update"><code>Cache::search_update</code></a> whenever <ahref="struct.DFA.html#method.next_state"title="method regex_automata::hybrid::dfa::DFA::next_state"><code>DFA::next_state</code></a> is
called.</li>
<li>Call <ahref="struct.Cache.html#method.search_finish"title="method regex_automata::hybrid::dfa::Cache::search_finish"><code>Cache::search_finish</code></a> before completing a search. (It is
not strictly necessary to call this when an error is returned, as
<code>Cache::search_start</code> will automatically finish the previous search
for you. But calling it where possible before returning helps improve
the accuracy of how many bytes have actually been searched.)</li>
</ul>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_match_kind"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#3715-3717">source</a><h4class="code-header">pub fn <ahref="#method.get_match_kind"class="fn">get_match_kind</a>(&self) -><aclass="enum"href="../../enum.MatchKind.html"title="enum regex_automata::MatchKind">MatchKind</a></h4></section></summary><divclass="docblock"><p>Returns the match semantics set in this configuration.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_prefilter"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#3720-3722">source</a><h4class="code-header">pub fn <ahref="#method.get_prefilter"class="fn">get_prefilter</a>(&self) -><aclass="enum"href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><&<aclass="struct"href="../../util/prefilter/struct.Prefilter.html"title="struct regex_automata::util::prefilter::Prefilter">Prefilter</a>></h4></section></summary><divclass="docblock"><p>Returns the prefilter set in this configuration, if one at all.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_starts_for_each_pattern"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#3726-3728">source</a><h4class="code-header">pub fn <ahref="#method.get_starts_for_each_pattern"class="fn">get_starts_for_each_pattern</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns whether this configuration has enabled anchored starting states
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_byte_classes"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#3733-3735">source</a><h4class="code-header">pub fn <ahref="#method.get_byte_classes"class="fn">get_byte_classes</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns whether this configuration has enabled byte classes or not.
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_unicode_word_boundary"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#3740-3742">source</a><h4class="code-header">pub fn <ahref="#method.get_unicode_word_boundary"class="fn">get_unicode_word_boundary</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns whether this configuration has enabled heuristic Unicode word
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_quit"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#3748-3750">source</a><h4class="code-header">pub fn <ahref="#method.get_quit"class="fn">get_quit</a>(&self, byte: <aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>) -><aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns whether this configuration will instruct the lazy DFA to enter
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_specialize_start_states"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#3757-3759">source</a><h4class="code-header">pub fn <ahref="#method.get_specialize_start_states"class="fn">get_specialize_start_states</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns whether this configuration will instruct the lazy DFA to
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_cache_capacity"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#3762-3764">source</a><h4class="code-header">pub fn <ahref="#method.get_cache_capacity"class="fn">get_cache_capacity</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a></h4></section></summary><divclass="docblock"><p>Returns the cache capacity set on this configuration.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_skip_cache_capacity_check"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#3767-3769">source</a><h4class="code-header">pub fn <ahref="#method.get_skip_cache_capacity_check"class="fn">get_skip_cache_capacity_check</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns whether the cache capacity check should be skipped.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_minimum_cache_clear_count"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#3775-3777">source</a><h4class="code-header">pub fn <ahref="#method.get_minimum_cache_clear_count"class="fn">get_minimum_cache_clear_count</a>(&self) -><aclass="enum"href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>></h4></section></summary><divclass="docblock"><p>Returns, if set, the minimum number of times the cache must be cleared
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_minimum_bytes_per_state"class="method"><aclass="src rightside"href="../../../src/regex_automata/hybrid/dfa.rs.html#3783-3785">source</a><h4class="code-header">pub fn <ahref="#method.get_minimum_bytes_per_state"class="fn">get_minimum_bytes_per_state</a>(&self) -><aclass="enum"href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>></h4></section></summary><divclass="docblock"><p>Returns, if set, the minimum number of bytes per state that need to be
<code><ahref="https://doc.rust-lang.org/1.77.0/core/convert/trait.From.html"title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-ToOwned-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.77.0/src/alloc/borrow.rs.html#83-85">source</a><ahref="#impl-ToOwned-for-T"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html"title="trait alloc::borrow::ToOwned">ToOwned</a> for T<divclass="where">where
T: <aclass="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><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Owned"class="associatedtype trait-impl"><ahref="#associatedtype.Owned"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned"class="associatedtype">Owned</a> = T</h4></section></summary><divclass='docblock'>The resulting type after obtaining ownership.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.to_owned"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.77.0/src/alloc/borrow.rs.html#88">source</a><ahref="#method.to_owned"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned"class="fn">to_owned</a>(&self) -> T</h4></section></summary><divclass='docblock'>Creates owned data from borrowed data, usually by cloning. <ahref="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.clone_into"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.77.0/src/alloc/borrow.rs.html#92">source</a><ahref="#method.clone_into"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html#method.clone_into"class="fn">clone_into</a>(&self, target: <aclass="primitive"href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&mut T</a>)</h4></section></summary><divclass='docblock'>Uses borrowed data to replace owned data, usually by cloning. <ahref="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryFrom%3CU%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.77.0/src/core/convert/mod.rs.html#804-806">source</a><ahref="#impl-TryFrom%3CU%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U> for T<divclass="where">where
U: <aclass="trait"href="https://doc.rust-lang.org/1.77.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error-1"class="associatedtype trait-impl"><ahref="#associatedtype.Error-1"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryFrom.html#associatedtype.Error"class="associatedtype">Error</a> = <aclass="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><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_from"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.77.0/src/core/convert/mod.rs.html#811">source</a><ahref="#method.try_from"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryFrom.html#tymethod.try_from"class="fn">try_from</a>(value: U) -><aclass="enum"href="https://doc.rust-lang.org/1.77.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><T, <T as <aclass="trait"href="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U>>::<aclass="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><divclass='docblock'>Performs the conversion.</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryInto%3CU%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.77.0/src/core/convert/mod.rs.html#789-791">source</a><ahref="#impl-TryInto%3CU%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryInto.html"title="trait core::convert::TryInto">TryInto</a><U> for T<divclass="where">where
U: <aclass="trait"href="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error"class="associatedtype trait-impl"><ahref="#associatedtype.Error"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryInto.html#associatedtype.Error"class="associatedtype">Error</a> = <U as <aclass="trait"href="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="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><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_into"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.77.0/src/core/convert/mod.rs.html#796">source</a><ahref="#method.try_into"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryInto.html#tymethod.try_into"class="fn">try_into</a>(self) -><aclass="enum"href="https://doc.rust-lang.org/1.77.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><U, <U as <aclass="trait"href="https://doc.rust-lang.org/1.77.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="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><divclass='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>