Adding large folders

This commit is contained in:
2026-02-26 12:00:21 -05:00
parent 5400d82acd
commit 49701c85ad
47332 changed files with 1942573 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../regex_automata/dfa/enum.StartError.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../regex_automata/dfa/enum.StartError.html">../../../regex_automata/dfa/enum.StartError.html</a>...</p>
<script>location.replace("../../../regex_automata/dfa/enum.StartError.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../regex_automata/dfa/struct.OverlappingState.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../regex_automata/dfa/struct.OverlappingState.html">../../../regex_automata/dfa/struct.OverlappingState.html</a>...</p>
<script>location.replace("../../../regex_automata/dfa/struct.OverlappingState.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../regex_automata/dfa/trait.Automaton.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../regex_automata/dfa/trait.Automaton.html">../../../regex_automata/dfa/trait.Automaton.html</a>...</p>
<script>location.replace("../../../regex_automata/dfa/trait.Automaton.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,6 @@
<!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="Types and routines specific to dense DFAs."><title>regex_automata::dfa::dense - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="regex_automata" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module dense</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../regex_automata/index.html">regex_<wbr>automata</a><span class="version">0.4.14</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module dense</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In regex_<wbr>automata::<wbr>dfa</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">regex_automata</a>::<wbr><a href="../index.html">dfa</a></div><h1>Module <span>dense</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/regex_automata/dfa/dense.rs.html#1-5260">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Types and routines specific to dense DFAs.</p>
<p>This module is the home of <a href="struct.DFA.html" title="struct regex_automata::dfa::dense::DFA"><code>dense::DFA</code></a>.</p>
<p>This module also contains a <a href="struct.Builder.html" title="struct regex_automata::dfa::dense::Builder"><code>dense::Builder</code></a> and a
<a href="struct.Config.html" title="struct regex_automata::dfa::dense::Config"><code>dense::Config</code></a> for building and configuring a dense DFA.</p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.BuildError.html" title="struct regex_automata::dfa::dense::BuildError">Build<wbr>Error</a></dt><dd>An error that occurred during the construction of a DFA.</dd><dt><a class="struct" href="struct.Builder.html" title="struct regex_automata::dfa::dense::Builder">Builder</a></dt><dd>A builder for constructing a deterministic finite automaton from regular
expressions.</dd><dt><a class="struct" href="struct.Config.html" title="struct regex_automata::dfa::dense::Config">Config</a></dt><dd>The configuration used for compiling a dense DFA.</dd><dt><a class="struct" href="struct.DFA.html" title="struct regex_automata::dfa::dense::DFA">DFA</a></dt><dd>A dense table-based deterministic finite automaton (DFA).</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["BuildError","Builder","Config","DFA"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,270 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A module for building and searching with deterministic finite automata (DFAs)."><title>regex_automata::dfa - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="regex_automata" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module dfa</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../regex_automata/index.html">regex_<wbr>automata</a><span class="version">0.4.14</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module dfa</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#overview" title="Overview">Overview</a></li><li><a href="#example-basic-regex-searching" title="Example: basic regex searching">Example: basic regex searching</a></li><li><a href="#example-searching-with-regex-sets" title="Example: searching with regex sets">Example: searching with regex sets</a></li><li><a href="#example-use-sparse-dfas" title="Example: use sparse DFAs">Example: use sparse DFAs</a></li><li><a href="#example-deserialize-a-dfa" title="Example: deserialize a DFA">Example: deserialize a DFA</a></li><li><a href="#support-for-no_std-and-alloc-only" title="Support for `no_std` and `alloc`-only">Support for <code>no_std</code> and <code>alloc</code>-only</a></li><li><a href="#syntax" title="Syntax">Syntax</a></li><li><a href="#differences-with-general-purpose-regexes" title="Differences with general purpose regexes">Differences with general purpose regexes</a></li></ul><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate regex_<wbr>automata</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">regex_automata</a></div><h1>Module <span>dfa</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/regex_automata/dfa/mod.rs.html#1-360">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A module for building and searching with deterministic finite automata (DFAs).</p>
<p>Like other modules in this crate, DFAs support a rich regex syntax with Unicode
features. DFAs also have extensive options for configuring the best space vs
time trade off for your use case and provides support for cheap deserialization
of automata for use in <code>no_std</code> environments.</p>
<p>If youre looking for lazy DFAs that build themselves incrementally during
search, then please see the top-level <a href="../hybrid/index.html" title="mod regex_automata::hybrid"><code>hybrid</code> module</a>.</p>
<h2 id="overview"><a class="doc-anchor" href="#overview">§</a>Overview</h2>
<p>This section gives a brief overview of the primary types in this module:</p>
<ul>
<li>A <a href="regex/struct.Regex.html" title="struct regex_automata::dfa::regex::Regex"><code>regex::Regex</code></a> provides a way to search for matches of a regular
expression using DFAs. This includes iterating over matches with both the start
and end positions of each match.</li>
<li>A <a href="dense/struct.DFA.html" title="struct regex_automata::dfa::dense::DFA"><code>dense::DFA</code></a> provides low level access to a DFA that uses a dense
representation (uses lots of space, but fast searching).</li>
<li>A <a href="sparse/struct.DFA.html" title="struct regex_automata::dfa::sparse::DFA"><code>sparse::DFA</code></a> provides the same API as a <code>dense::DFA</code>, but uses a sparse
representation (uses less space, but slower searching).</li>
<li>An <a href="trait.Automaton.html" title="trait regex_automata::dfa::Automaton"><code>Automaton</code></a> trait that defines an interface that both dense and sparse
DFAs implement. (A <code>regex::Regex</code> is generic over this trait.)</li>
<li>Both dense DFAs and sparse DFAs support serialization to raw bytes (e.g.,
<a href="dense/struct.DFA.html#method.to_bytes_little_endian" title="method regex_automata::dfa::dense::DFA::to_bytes_little_endian"><code>dense::DFA::to_bytes_little_endian</code></a>) and cheap deserialization (e.g.,
<a href="dense/struct.DFA.html#method.from_bytes" title="associated function regex_automata::dfa::dense::DFA::from_bytes"><code>dense::DFA::from_bytes</code></a>).</li>
</ul>
<p>There is also a <a href="onepass/index.html" title="mod regex_automata::dfa::onepass"><code>onepass</code></a> module that provides a <a href="onepass/struct.DFA.html" title="struct regex_automata::dfa::onepass::DFA">one-pass
DFA</a>. The unique advantage of this DFA is that, for the class
of regexes it can be built with, it supports reporting the spans of matching
capturing groups. It is the only DFA in this crate capable of such a thing.</p>
<h2 id="example-basic-regex-searching"><a class="doc-anchor" href="#example-basic-regex-searching">§</a>Example: basic regex searching</h2>
<p>This example shows how to compile a regex using the default configuration
and then use it to find matches in a byte string:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex_automata::{Match, dfa::regex::Regex};
<span class="kw">let </span>re = Regex::new(<span class="string">r"[0-9]{4}-[0-9]{2}-[0-9]{2}"</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>text = <span class="string">b"2018-12-24 2016-10-08"</span>;
<span class="kw">let </span>matches: Vec&lt;Match&gt; = re.find_iter(text).collect();
<span class="macro">assert_eq!</span>(matches, <span class="macro">vec!</span>[
Match::must(<span class="number">0</span>, <span class="number">0</span>..<span class="number">10</span>),
Match::must(<span class="number">0</span>, <span class="number">11</span>..<span class="number">21</span>),
]);</code></pre></div><h2 id="example-searching-with-regex-sets"><a class="doc-anchor" href="#example-searching-with-regex-sets">§</a>Example: searching with regex sets</h2>
<p>The DFAs in this module all fully support searching with multiple regexes
simultaneously. You can use this support with standard leftmost-first style
searching to find non-overlapping matches:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex_automata::{Match, dfa::regex::Regex};
<span class="kw">let </span>re = Regex::new_many(<span class="kw-2">&amp;</span>[<span class="string">r"\w+"</span>, <span class="string">r"\S+"</span>])<span class="question-mark">?</span>;
<span class="kw">let </span>text = <span class="string">b"@foo bar"</span>;
<span class="kw">let </span>matches: Vec&lt;Match&gt; = re.find_iter(text).collect();
<span class="macro">assert_eq!</span>(matches, <span class="macro">vec!</span>[
Match::must(<span class="number">1</span>, <span class="number">0</span>..<span class="number">4</span>),
Match::must(<span class="number">0</span>, <span class="number">5</span>..<span class="number">8</span>),
]);</code></pre></div><h2 id="example-use-sparse-dfas"><a class="doc-anchor" href="#example-use-sparse-dfas">§</a>Example: use sparse DFAs</h2>
<p>By default, compiling a regex will use dense DFAs internally. This uses more
memory, but executes searches more quickly. If you can abide slower searches
(somewhere around 3-5x), then sparse DFAs might make more sense since they can
use significantly less space.</p>
<p>Using sparse DFAs is as easy as using <code>Regex::new_sparse</code> instead of
<code>Regex::new</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex_automata::{Match, dfa::regex::Regex};
<span class="kw">let </span>re = Regex::new_sparse(<span class="string">r"[0-9]{4}-[0-9]{2}-[0-9]{2}"</span>).unwrap();
<span class="kw">let </span>text = <span class="string">b"2018-12-24 2016-10-08"</span>;
<span class="kw">let </span>matches: Vec&lt;Match&gt; = re.find_iter(text).collect();
<span class="macro">assert_eq!</span>(matches, <span class="macro">vec!</span>[
Match::must(<span class="number">0</span>, <span class="number">0</span>..<span class="number">10</span>),
Match::must(<span class="number">0</span>, <span class="number">11</span>..<span class="number">21</span>),
]);</code></pre></div>
<p>If you already have dense DFAs for some reason, they can be converted to sparse
DFAs and used to build a new <code>Regex</code>. For example:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex_automata::{Match, dfa::regex::Regex};
<span class="kw">let </span>dense_re = Regex::new(<span class="string">r"[0-9]{4}-[0-9]{2}-[0-9]{2}"</span>).unwrap();
<span class="kw">let </span>sparse_re = Regex::builder().build_from_dfas(
dense_re.forward().to_sparse()<span class="question-mark">?</span>,
dense_re.reverse().to_sparse()<span class="question-mark">?</span>,
);
<span class="kw">let </span>text = <span class="string">b"2018-12-24 2016-10-08"</span>;
<span class="kw">let </span>matches: Vec&lt;Match&gt; = sparse_re.find_iter(text).collect();
<span class="macro">assert_eq!</span>(matches, <span class="macro">vec!</span>[
Match::must(<span class="number">0</span>, <span class="number">0</span>..<span class="number">10</span>),
Match::must(<span class="number">0</span>, <span class="number">11</span>..<span class="number">21</span>),
]);</code></pre></div><h2 id="example-deserialize-a-dfa"><a class="doc-anchor" href="#example-deserialize-a-dfa">§</a>Example: deserialize a DFA</h2>
<p>This shows how to first serialize a DFA into raw bytes, and then deserialize
those raw bytes back into a DFA. While this particular example is a
bit contrived, this same technique can be used in your program to
deserialize a DFA at start up time or by memory mapping a file.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex_automata::{Match, dfa::{dense, regex::Regex}};
<span class="kw">let </span>re1 = Regex::new(<span class="string">r"[0-9]{4}-[0-9]{2}-[0-9]{2}"</span>).unwrap();
<span class="comment">// serialize both the forward and reverse DFAs, see note below
</span><span class="kw">let </span>(fwd_bytes, fwd_pad) = re1.forward().to_bytes_native_endian();
<span class="kw">let </span>(rev_bytes, rev_pad) = re1.reverse().to_bytes_native_endian();
<span class="comment">// now deserialize both---we need to specify the correct type!
</span><span class="kw">let </span>fwd: dense::DFA&lt;<span class="kw-2">&amp;</span>[u32]&gt; = dense::DFA::from_bytes(<span class="kw-2">&amp;</span>fwd_bytes[fwd_pad..])<span class="question-mark">?</span>.<span class="number">0</span>;
<span class="kw">let </span>rev: dense::DFA&lt;<span class="kw-2">&amp;</span>[u32]&gt; = dense::DFA::from_bytes(<span class="kw-2">&amp;</span>rev_bytes[rev_pad..])<span class="question-mark">?</span>.<span class="number">0</span>;
<span class="comment">// finally, reconstruct our regex
</span><span class="kw">let </span>re2 = Regex::builder().build_from_dfas(fwd, rev);
<span class="comment">// we can use it like normal
</span><span class="kw">let </span>text = <span class="string">b"2018-12-24 2016-10-08"</span>;
<span class="kw">let </span>matches: Vec&lt;Match&gt; = re2.find_iter(text).collect();
<span class="macro">assert_eq!</span>(matches, <span class="macro">vec!</span>[
Match::must(<span class="number">0</span>, <span class="number">0</span>..<span class="number">10</span>),
Match::must(<span class="number">0</span>, <span class="number">11</span>..<span class="number">21</span>),
]);</code></pre></div>
<p>There are a few points worth noting here:</p>
<ul>
<li>We need to extract the raw DFAs used by the regex and serialize those. You
can build the DFAs manually yourself using <a href="dense/struct.Builder.html" title="struct regex_automata::dfa::dense::Builder"><code>dense::Builder</code></a>, but using
the DFAs from a <code>Regex</code> guarantees that the DFAs are built correctly. (In
particular, a <code>Regex</code> constructs a reverse DFA for finding the starting
location of matches.)</li>
<li>To convert the DFA to raw bytes, we use the <code>to_bytes_native_endian</code> method.
In practice, youll want to use either <a href="dense/struct.DFA.html#method.to_bytes_little_endian" title="method regex_automata::dfa::dense::DFA::to_bytes_little_endian"><code>dense::DFA::to_bytes_little_endian</code></a>
or <a href="dense/struct.DFA.html#method.to_bytes_big_endian" title="method regex_automata::dfa::dense::DFA::to_bytes_big_endian"><code>dense::DFA::to_bytes_big_endian</code></a>, depending on which platform youre
deserializing your DFA from. If you intend to deserialize on either platform,
then youll need to serialize both and deserialize the right one depending on
your targets endianness.</li>
<li>Safely deserializing a DFA requires verifying the raw bytes, particularly if
they are untrusted, since an invalid DFA could cause logical errors, panics
or even undefined behavior. This verification step requires visiting all of
the transitions in the DFA, which can be costly. If cheaper verification is
desired, then <a href="dense/struct.DFA.html#method.from_bytes_unchecked" title="associated function regex_automata::dfa::dense::DFA::from_bytes_unchecked"><code>dense::DFA::from_bytes_unchecked</code></a> is available that only does
verification that can be performed in constant time. However, one can only use
this routine if the caller can guarantee that the bytes provided encoded a
valid DFA.</li>
</ul>
<p>The same process can be achieved with sparse DFAs as well:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex_automata::{Match, dfa::{sparse, regex::Regex}};
<span class="kw">let </span>re1 = Regex::new(<span class="string">r"[0-9]{4}-[0-9]{2}-[0-9]{2}"</span>).unwrap();
<span class="comment">// serialize both
</span><span class="kw">let </span>fwd_bytes = re1.forward().to_sparse()<span class="question-mark">?</span>.to_bytes_native_endian();
<span class="kw">let </span>rev_bytes = re1.reverse().to_sparse()<span class="question-mark">?</span>.to_bytes_native_endian();
<span class="comment">// now deserialize both---we need to specify the correct type!
</span><span class="kw">let </span>fwd: sparse::DFA&lt;<span class="kw-2">&amp;</span>[u8]&gt; = sparse::DFA::from_bytes(<span class="kw-2">&amp;</span>fwd_bytes)<span class="question-mark">?</span>.<span class="number">0</span>;
<span class="kw">let </span>rev: sparse::DFA&lt;<span class="kw-2">&amp;</span>[u8]&gt; = sparse::DFA::from_bytes(<span class="kw-2">&amp;</span>rev_bytes)<span class="question-mark">?</span>.<span class="number">0</span>;
<span class="comment">// finally, reconstruct our regex
</span><span class="kw">let </span>re2 = Regex::builder().build_from_dfas(fwd, rev);
<span class="comment">// we can use it like normal
</span><span class="kw">let </span>text = <span class="string">b"2018-12-24 2016-10-08"</span>;
<span class="kw">let </span>matches: Vec&lt;Match&gt; = re2.find_iter(text).collect();
<span class="macro">assert_eq!</span>(matches, <span class="macro">vec!</span>[
Match::must(<span class="number">0</span>, <span class="number">0</span>..<span class="number">10</span>),
Match::must(<span class="number">0</span>, <span class="number">11</span>..<span class="number">21</span>),
]);</code></pre></div>
<p>Note that unlike dense DFAs, sparse DFAs have no alignment requirements.
Conversely, dense DFAs must be aligned to the same alignment as a
<a href="../util/primitives/struct.StateID.html" title="struct regex_automata::util::primitives::StateID"><code>StateID</code></a>.</p>
<h2 id="support-for-no_std-and-alloc-only"><a class="doc-anchor" href="#support-for-no_std-and-alloc-only">§</a>Support for <code>no_std</code> and <code>alloc</code>-only</h2>
<p>This crate comes with <code>alloc</code> and <code>std</code> features that are enabled by default.
When the <code>alloc</code> or <code>std</code> features are enabled, the API of this module will
include the facilities necessary for compiling, serializing, deserializing
and searching with DFAs. When only the <code>alloc</code> feature is enabled, then
implementations of the <code>std::error::Error</code> trait are dropped, but everything
else generally remains the same. When both the <code>alloc</code> and <code>std</code> features are
disabled, the API of this module will shrink such that it only includes the
facilities necessary for deserializing and searching with DFAs.</p>
<p>The intended workflow for <code>no_std</code> environments is thus as follows:</p>
<ul>
<li>Write a program with the <code>alloc</code> or <code>std</code> features that compiles and
serializes a regular expression. You may need to serialize both little and big
endian versions of each DFA. (So thats 4 DFAs in total for each regex.)</li>
<li>In your <code>no_std</code> environment, follow the examples above for deserializing
your previously serialized DFAs into regexes. You can then search with them as
you would any regex.</li>
</ul>
<p>Deserialization can happen anywhere. For example, with bytes embedded into a
binary or with a file memory mapped at runtime.</p>
<p>The <code>regex-cli</code> command (found in the same repository as this crate) can be
used to serialize DFAs to files and generate Rust code to read them.</p>
<h2 id="syntax"><a class="doc-anchor" href="#syntax">§</a>Syntax</h2>
<p>This module supports the same syntax as the <code>regex</code> crate, since they share the
same parser. You can find an exhaustive list of supported syntax in the
<a href="https://docs.rs/regex/1/regex/#syntax">documentation for the <code>regex</code> crate</a>.</p>
<p>There are two things that are not supported by the DFAs in this module:</p>
<ul>
<li>Capturing groups. The DFAs (and <a href="regex/struct.Regex.html" title="struct regex_automata::dfa::regex::Regex"><code>Regex</code></a>es built on top
of them) can only find the offsets of an entire match, but cannot resolve
the offsets of each capturing group. This is because DFAs do not have the
expressive power necessary.</li>
<li>Unicode word boundaries. These present particularly difficult challenges for
DFA construction and would result in an explosion in the number of states.
One can enable <a href="dense/struct.Config.html#method.unicode_word_boundary" title="method regex_automata::dfa::dense::Config::unicode_word_boundary"><code>dense::Config::unicode_word_boundary</code></a> though, which provides
heuristic support for Unicode word boundaries that only works on ASCII text.
Otherwise, one can use <code>(?-u:\b)</code> for an ASCII word boundary, which will work
on any input.</li>
</ul>
<p>There are no plans to lift either of these limitations.</p>
<p>Note that these restrictions are identical to the restrictions on lazy DFAs.</p>
<h2 id="differences-with-general-purpose-regexes"><a class="doc-anchor" href="#differences-with-general-purpose-regexes">§</a>Differences with general purpose regexes</h2>
<p>The main goal of the <a href="https://docs.rs/regex"><code>regex</code></a> crate is to serve as a
general purpose regular expression engine. It aims to automatically balance low
compile times, fast search times and low memory usage, while also providing
a convenient API for users. In contrast, this module provides a lower level
regular expression interface based exclusively on DFAs that is a bit less
convenient while providing more explicit control over memory usage and search
times.</p>
<p>Here are some specific negative differences:</p>
<ul>
<li><strong>Compilation can take an exponential amount of time and space</strong> in the size
of the regex pattern. While most patterns do not exhibit worst case exponential
time, such patterns do exist. For example, <code>[01]*1[01]{N}</code> will build a DFA
with approximately <code>2^(N+2)</code> states. For this reason, untrusted patterns should
not be compiled with this module. (In the future, the API may expose an option
to return an error if the DFA gets too big.)</li>
<li>This module does not support sub-match extraction via capturing groups, which
can be achieved with the regex crates “captures” API.</li>
<li>While the regex crate doesnt necessarily sport fast compilation times,
the regexes in this module are almost universally slow to compile, especially
when they contain large Unicode character classes. For example, on my system,
compiling <code>\w{50}</code> takes about 1 second and almost 15MB of memory! (Compiling
a sparse regex takes about the same time but only uses about 1.2MB of
memory.) Conversely, compiling the same regex without Unicode support, e.g.,
<code>(?-u)\w{50}</code>, takes under 1 millisecond and about 15KB of memory. For this
reason, you should only use Unicode character classes if you absolutely need
them! (They are enabled by default though.)</li>
<li>This module does not support Unicode word boundaries. ASCII word boundaries
may be used though by disabling Unicode or selectively doing so in the syntax,
e.g., <code>(?-u:\b)</code>. There is also an option to
<a href="dense/struct.Config.html#method.unicode_word_boundary" title="method regex_automata::dfa::dense::Config::unicode_word_boundary">heuristically enable Unicode word boundaries</a>,
where the corresponding DFA will give up if any non-ASCII byte is seen.</li>
<li>As a lower level API, this module does not do literal optimizations
automatically. Although it does provide hooks in its API to make use of the
<a href="../util/prefilter/struct.Prefilter.html" title="struct regex_automata::util::prefilter::Prefilter"><code>Prefilter</code></a> trait. Missing literal
optimizations means that searches may run much slower than what youre
accustomed to, although, it does provide more predictable and consistent
performance.</li>
<li>There is no <code>&amp;str</code> API like in the regex crate. In this module, all APIs
operate on <code>&amp;[u8]</code>. By default, match indices are
guaranteed to fall on UTF-8 boundaries, unless either of
<a href="../util/syntax/struct.Config.html#method.utf8" title="method regex_automata::util::syntax::Config::utf8"><code>syntax::Config::utf8</code></a> or
<a href="../nfa/thompson/struct.Config.html#method.utf8" title="method regex_automata::nfa::thompson::Config::utf8"><code>thompson::Config::utf8</code></a> are disabled.</li>
</ul>
<p>With some of the downsides out of the way, here are some positive differences:</p>
<ul>
<li>Both dense and sparse DFAs can be serialized to raw bytes, and then cheaply
deserialized. Deserialization can be done in constant time with the unchecked
APIs, since searching can be performed directly on the raw serialized bytes of
a DFA.</li>
<li>This module was specifically designed so that the searching phase of a
DFA has minimal runtime requirements, and can therefore be used in <code>no_std</code>
environments. While <code>no_std</code> environments cannot compile regexes, they can
deserialize pre-compiled regexes.</li>
<li>Since this module builds DFAs ahead of time, it will generally out-perform
the <code>regex</code> crate on equivalent tasks. The performance difference is likely
not large. However, because of a complex set of optimizations in the regex
crate (like literal optimizations), an accurate performance comparison may be
difficult to do.</li>
<li>Sparse DFAs provide a way to build a DFA ahead of time that sacrifices search
performance a small amount, but uses much less storage space. Potentially even
less than what the regex crate uses.</li>
<li>This module exposes DFAs directly, such as <a href="dense/struct.DFA.html" title="struct regex_automata::dfa::dense::DFA"><code>dense::DFA</code></a> and
<a href="sparse/struct.DFA.html" title="struct regex_automata::dfa::sparse::DFA"><code>sparse::DFA</code></a>, which enables one to do less work in some cases. For example,
if you only need the end of a match and not the start of a match, then you can
use a DFA directly without building a <code>Regex</code>, which always requires a second
DFA to find the start of a match.</li>
<li>This module provides more control over memory usage. Aside from choosing
between dense and sparse DFAs, one can also choose a smaller state identifier
representation to use less space. Also, one can enable DFA minimization
via <a href="dense/struct.Config.html#method.minimize" title="method regex_automata::dfa::dense::Config::minimize"><code>dense::Config::minimize</code></a>, but it can increase compilation times
dramatically.</li>
</ul>
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="dense/index.html" title="mod regex_automata::dfa::dense">dense</a></dt><dd>Types and routines specific to dense DFAs.</dd><dt><a class="mod" href="onepass/index.html" title="mod regex_automata::dfa::onepass">onepass</a></dt><dd>A DFA that can return spans for matching capturing groups.</dd><dt><a class="mod" href="regex/index.html" title="mod regex_automata::dfa::regex">regex</a></dt><dd>A DFA-backed <code>Regex</code>.</dd><dt><a class="mod" href="sparse/index.html" title="mod regex_automata::dfa::sparse">sparse</a></dt><dd>Types and routines specific to sparse DFAs.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.OverlappingState.html" title="struct regex_automata::dfa::OverlappingState">Overlapping<wbr>State</a></dt><dd>Represents the current state of an overlapping search.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.StartError.html" title="enum regex_automata::dfa::StartError">Start<wbr>Error</a></dt><dd>An error that can occur when computing the start state for a search.</dd><dt><a class="enum" href="enum.StartKind.html" title="enum regex_automata::dfa::StartKind">Start<wbr>Kind</a></dt><dd>The kind of anchored starting configurations to support in a DFA.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.Automaton.html" title="trait regex_automata::dfa::Automaton">Automaton</a></dt><dd>A trait describing the interface of a deterministic finite automaton (DFA).</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1,7 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A DFA that can return spans for matching capturing groups."><title>regex_automata::dfa::onepass - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="regex_automata" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module onepass</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../regex_automata/index.html">regex_<wbr>automata</a><span class="version">0.4.14</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module onepass</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In regex_<wbr>automata::<wbr>dfa</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">regex_automata</a>::<wbr><a href="../index.html">dfa</a></div><h1>Module <span>onepass</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/regex_automata/dfa/onepass.rs.html#1-3208">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A DFA that can return spans for matching capturing groups.</p>
<p>This module is the home of a <a href="struct.DFA.html" title="struct regex_automata::dfa::onepass::DFA">one-pass DFA</a>.</p>
<p>This module also contains a <a href="struct.Builder.html" title="struct regex_automata::dfa::onepass::Builder"><code>Builder</code></a> and a <a href="struct.Config.html" title="struct regex_automata::dfa::onepass::Config"><code>Config</code></a> for building and
configuring a one-pass DFA.</p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.BuildError.html" title="struct regex_automata::dfa::onepass::BuildError">Build<wbr>Error</a></dt><dd>An error that occurred during the construction of a one-pass DFA.</dd><dt><a class="struct" href="struct.Builder.html" title="struct regex_automata::dfa::onepass::Builder">Builder</a></dt><dd>A builder for a <a href="struct.DFA.html" title="struct regex_automata::dfa::onepass::DFA">one-pass DFA</a>.</dd><dt><a class="struct" href="struct.Cache.html" title="struct regex_automata::dfa::onepass::Cache">Cache</a></dt><dd>A cache represents mutable state that a one-pass <a href="struct.DFA.html" title="struct regex_automata::dfa::onepass::DFA"><code>DFA</code></a> requires during a
search.</dd><dt><a class="struct" href="struct.Config.html" title="struct regex_automata::dfa::onepass::Config">Config</a></dt><dd>The configuration used for building a <a href="struct.DFA.html" title="struct regex_automata::dfa::onepass::DFA">one-pass DFA</a>.</dd><dt><a class="struct" href="struct.DFA.html" title="struct regex_automata::dfa::onepass::DFA">DFA</a></dt><dd>A one-pass DFA for executing a subset of anchored regex searches while
resolving capturing groups.</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["BuildError","Builder","Cache","Config","DFA"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,13 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A DFA-backed `Regex`."><title>regex_automata::dfa::regex - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="regex_automata" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module regex</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../regex_automata/index.html">regex_<wbr>automata</a><span class="version">0.4.14</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module regex</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In regex_<wbr>automata::<wbr>dfa</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">regex_automata</a>::<wbr><a href="../index.html">dfa</a></div><h1>Module <span>regex</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/regex_automata/dfa/regex.rs.html#1-870">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A DFA-backed <code>Regex</code>.</p>
<p>This module provides <a href="struct.Regex.html" title="struct regex_automata::dfa::regex::Regex"><code>Regex</code></a>, which is defined generically over the
<a href="../trait.Automaton.html" title="trait regex_automata::dfa::Automaton"><code>Automaton</code></a> trait. A <code>Regex</code> implements convenience routines you might have
come to expect, such as finding the start/end of a match and iterating over
all non-overlapping matches. This <code>Regex</code> type is limited in its capabilities
to what a DFA can provide. Therefore, APIs involving capturing groups, for
example, are not provided.</p>
<p>Internally, a <code>Regex</code> is composed of two DFAs. One is a “forward” DFA that
finds the end offset of a match, where as the other is a “reverse” DFA that
find the start offset of a match.</p>
<p>See the <a href="../index.html" title="mod regex_automata::dfa">parent module</a> for examples.</p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Builder.html" title="struct regex_automata::dfa::regex::Builder">Builder</a></dt><dd>A builder for a regex based on deterministic finite automatons.</dd><dt><a class="struct" href="struct.FindMatches.html" title="struct regex_automata::dfa::regex::FindMatches">Find<wbr>Matches</a></dt><dd>An iterator over all non-overlapping matches for an infallible search.</dd><dt><a class="struct" href="struct.Regex.html" title="struct regex_automata::dfa::regex::Regex">Regex</a></dt><dd>A regular expression that uses deterministic finite automata for fast
searching.</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["Builder","FindMatches","Regex"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"enum":["StartError","StartKind"],"mod":["dense","onepass","regex","sparse"],"struct":["OverlappingState"],"trait":["Automaton"]};

View File

@@ -0,0 +1,30 @@
<!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="Types and routines specific to sparse DFAs."><title>regex_automata::dfa::sparse - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="regex_automata" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module sparse</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../regex_automata/index.html">regex_<wbr>automata</a><span class="version">0.4.14</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module sparse</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In regex_<wbr>automata::<wbr>dfa</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">regex_automata</a>::<wbr><a href="../index.html">dfa</a></div><h1>Module <span>sparse</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/regex_automata/dfa/sparse.rs.html#1-2655">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Types and routines specific to sparse DFAs.</p>
<p>This module is the home of <a href="struct.DFA.html" title="struct regex_automata::dfa::sparse::DFA"><code>sparse::DFA</code></a>.</p>
<p>Unlike the <a href="../dense/index.html" title="mod regex_automata::dfa::dense"><code>dense</code></a> module, this module does not contain a builder or
configuration specific for sparse DFAs. Instead, the intended way to build a
sparse DFA is either by using a default configuration with its constructor
<a href="struct.DFA.html#method.new" title="associated function regex_automata::dfa::sparse::DFA::new"><code>sparse::DFA::new</code></a>, or by first configuring the construction of a
dense DFA with <a href="../dense/struct.Builder.html" title="struct regex_automata::dfa::dense::Builder"><code>dense::Builder</code></a> and then calling <a href="../dense/struct.DFA.html#method.to_sparse" title="method regex_automata::dfa::dense::DFA::to_sparse"><code>dense::DFA::to_sparse</code></a>.
For example, this configures a sparse DFA to do an overlapping search:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex_automata::{
dfa::{Automaton, OverlappingState, dense},
HalfMatch, Input, MatchKind,
};
<span class="kw">let </span>dense_re = dense::Builder::new()
.configure(dense::Config::new().match_kind(MatchKind::All))
.build(<span class="string">r"Samwise|Sam"</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>sparse_re = dense_re.to_sparse()<span class="question-mark">?</span>;
<span class="comment">// Setup our haystack and initial start state.
</span><span class="kw">let </span>input = Input::new(<span class="string">"Samwise"</span>);
<span class="kw">let </span><span class="kw-2">mut </span>state = OverlappingState::start();
<span class="comment">// First, 'Sam' will match.
</span>sparse_re.try_search_overlapping_fwd(<span class="kw-2">&amp;</span>input, <span class="kw-2">&amp;mut </span>state)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(HalfMatch::must(<span class="number">0</span>, <span class="number">3</span>)), state.get_match());
<span class="comment">// And now 'Samwise' will match.
</span>sparse_re.try_search_overlapping_fwd(<span class="kw-2">&amp;</span>input, <span class="kw-2">&amp;mut </span>state)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(HalfMatch::must(<span class="number">0</span>, <span class="number">7</span>)), state.get_match());</code></pre></div></div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.DFA.html" title="struct regex_automata::dfa::sparse::DFA">DFA</a></dt><dd>A sparse deterministic finite automaton (DFA) with variable sized states.</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["DFA"]};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../regex_automata/dfa/enum.StartKind.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../regex_automata/dfa/enum.StartKind.html">../../../regex_automata/dfa/enum.StartKind.html</a>...</p>
<script>location.replace("../../../regex_automata/dfa/enum.StartKind.html" + location.search + location.hash);</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
<!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="Types and routines specific to lazy DFAs."><title>regex_automata::hybrid::dfa - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="regex_automata" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module dfa</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../regex_automata/index.html">regex_<wbr>automata</a><span class="version">0.4.14</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module dfa</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In regex_<wbr>automata::<wbr>hybrid</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">regex_automata</a>::<wbr><a href="../index.html">hybrid</a></div><h1>Module <span>dfa</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/regex_automata/hybrid/dfa.rs.html#1-4434">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Types and routines specific to lazy DFAs.</p>
<p>This module is the home of <a href="struct.DFA.html" title="struct regex_automata::hybrid::dfa::DFA"><code>hybrid::dfa::DFA</code></a>.</p>
<p>This module also contains a <a href="struct.Builder.html" title="struct regex_automata::hybrid::dfa::Builder"><code>hybrid::dfa::Builder</code></a> and a
<a href="struct.Config.html" title="struct regex_automata::hybrid::dfa::Config"><code>hybrid::dfa::Config</code></a> for configuring and building a lazy DFA.</p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Builder.html" title="struct regex_automata::hybrid::dfa::Builder">Builder</a></dt><dd>A builder for constructing a lazy deterministic finite automaton from
regular expressions.</dd><dt><a class="struct" href="struct.Cache.html" title="struct regex_automata::hybrid::dfa::Cache">Cache</a></dt><dd>A cache represents a partially computed DFA.</dd><dt><a class="struct" href="struct.Config.html" title="struct regex_automata::hybrid::dfa::Config">Config</a></dt><dd>The configuration used for building a lazy DFA.</dd><dt><a class="struct" href="struct.DFA.html" title="struct regex_automata::hybrid::dfa::DFA">DFA</a></dt><dd>A hybrid NFA/DFA (also called a “lazy DFA”) for regex searching.</dd><dt><a class="struct" href="struct.OverlappingState.html" title="struct regex_automata::hybrid::dfa::OverlappingState">Overlapping<wbr>State</a></dt><dd>Represents the current state of an overlapping search.</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["Builder","Cache","Config","DFA","OverlappingState"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../regex_automata/hybrid/enum.StartError.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../regex_automata/hybrid/enum.StartError.html">../../../regex_automata/hybrid/enum.StartError.html</a>...</p>
<script>location.replace("../../../regex_automata/hybrid/enum.StartError.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../regex_automata/hybrid/struct.BuildError.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../regex_automata/hybrid/struct.BuildError.html">../../../regex_automata/hybrid/struct.BuildError.html</a>...</p>
<script>location.replace("../../../regex_automata/hybrid/struct.BuildError.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../regex_automata/hybrid/struct.CacheError.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../regex_automata/hybrid/struct.CacheError.html">../../../regex_automata/hybrid/struct.CacheError.html</a>...</p>
<script>location.replace("../../../regex_automata/hybrid/struct.CacheError.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../regex_automata/hybrid/struct.LazyStateID.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../regex_automata/hybrid/struct.LazyStateID.html">../../../regex_automata/hybrid/struct.LazyStateID.html</a>...</p>
<script>location.replace("../../../regex_automata/hybrid/struct.LazyStateID.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,105 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A module for building and searching with lazy deterministic finite automata (DFAs)."><title>regex_automata::hybrid - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="regex_automata" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module hybrid</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../regex_automata/index.html">regex_<wbr>automata</a><span class="version">0.4.14</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module hybrid</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#overview" title="Overview">Overview</a></li><li><a href="#example-basic-regex-searching" title="Example: basic regex searching">Example: basic regex searching</a></li><li><a href="#example-searching-with-multiple-regexes" title="Example: searching with multiple regexes">Example: searching with multiple regexes</a></li><li><a href="#when-should-i-use-this" title="When should I use this?">When should I use this?</a></li><li><a href="#differences-with-fully-compiled-dfas" title="Differences with fully compiled DFAs">Differences with fully compiled DFAs</a></li><li><a href="#syntax" title="Syntax">Syntax</a></li></ul><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate regex_<wbr>automata</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">regex_automata</a></div><h1>Module <span>hybrid</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/regex_automata/hybrid/mod.rs.html#1-144">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A module for building and searching with lazy deterministic finite automata
(DFAs).</p>
<p>Like other modules in this crate, lazy DFAs support a rich regex syntax with
Unicode features. The key feature of a lazy DFA is that it builds itself
incrementally during search, and never uses more than a configured capacity of
memory. Thus, when searching with a lazy DFA, one must supply a mutable “cache”
in which the actual DFAs transition table is stored.</p>
<p>If youre looking for fully compiled DFAs, then please see the top-level
<a href="../dfa/index.html" title="mod regex_automata::dfa"><code>dfa</code> module</a>.</p>
<h2 id="overview"><a class="doc-anchor" href="#overview">§</a>Overview</h2>
<p>This section gives a brief overview of the primary types in this module:</p>
<ul>
<li>A <a href="regex/struct.Regex.html" title="struct regex_automata::hybrid::regex::Regex"><code>regex::Regex</code></a> provides a way to search for matches of a regular
expression using lazy DFAs. This includes iterating over matches with both the
start and end positions of each match.</li>
<li>A <a href="dfa/struct.DFA.html" title="struct regex_automata::hybrid::dfa::DFA"><code>dfa::DFA</code></a> provides direct low level access to a lazy DFA.</li>
</ul>
<h2 id="example-basic-regex-searching"><a class="doc-anchor" href="#example-basic-regex-searching">§</a>Example: basic regex searching</h2>
<p>This example shows how to compile a regex using the default configuration
and then use it to find matches in a byte string:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex_automata::{hybrid::regex::Regex, Match};
<span class="kw">let </span>re = Regex::new(<span class="string">r"[0-9]{4}-[0-9]{2}-[0-9]{2}"</span>)<span class="question-mark">?</span>;
<span class="kw">let </span><span class="kw-2">mut </span>cache = re.create_cache();
<span class="kw">let </span>haystack = <span class="string">"2018-12-24 2016-10-08"</span>;
<span class="kw">let </span>matches: Vec&lt;Match&gt; = re.find_iter(<span class="kw-2">&amp;mut </span>cache, haystack).collect();
<span class="macro">assert_eq!</span>(matches, <span class="macro">vec!</span>[
Match::must(<span class="number">0</span>, <span class="number">0</span>..<span class="number">10</span>),
Match::must(<span class="number">0</span>, <span class="number">11</span>..<span class="number">21</span>),
]);</code></pre></div><h2 id="example-searching-with-multiple-regexes"><a class="doc-anchor" href="#example-searching-with-multiple-regexes">§</a>Example: searching with multiple regexes</h2>
<p>The lazy DFAs in this module all fully support searching with multiple regexes
simultaneously. You can use this support with standard leftmost-first style
searching to find non-overlapping matches:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>regex_automata::{hybrid::regex::Regex, Match};
<span class="kw">let </span>re = Regex::new_many(<span class="kw-2">&amp;</span>[<span class="string">r"\w+"</span>, <span class="string">r"\S+"</span>])<span class="question-mark">?</span>;
<span class="kw">let </span><span class="kw-2">mut </span>cache = re.create_cache();
<span class="kw">let </span>haystack = <span class="string">"@foo bar"</span>;
<span class="kw">let </span>matches: Vec&lt;Match&gt; = re.find_iter(<span class="kw-2">&amp;mut </span>cache, haystack).collect();
<span class="macro">assert_eq!</span>(matches, <span class="macro">vec!</span>[
Match::must(<span class="number">1</span>, <span class="number">0</span>..<span class="number">4</span>),
Match::must(<span class="number">0</span>, <span class="number">5</span>..<span class="number">8</span>),
]);</code></pre></div><h2 id="when-should-i-use-this"><a class="doc-anchor" href="#when-should-i-use-this">§</a>When should I use this?</h2>
<p>Generally speaking, if you can abide the use of mutable state during search,
and you dont need things like capturing groups or Unicode word boundary
support in non-ASCII text, then a lazy DFA is likely a robust choice with
respect to both search speed and memory usage. Note however that its speed
may be worse than a general purpose regex engine if you dont select a good
<a href="../util/prefilter/index.html" title="mod regex_automata::util::prefilter">prefilter</a>.</p>
<p>If you know ahead of time that your pattern would result in a very large DFA
if it was fully compiled, it may be better to use an NFA simulation instead
of a lazy DFA. Either that, or increase the cache capacity of your lazy DFA
to something that is big enough to hold the state machine (likely through
experimentation). The issue here is that if the cache is too small, then it
could wind up being reset too frequently and this might decrease searching
speed significantly.</p>
<h2 id="differences-with-fully-compiled-dfas"><a class="doc-anchor" href="#differences-with-fully-compiled-dfas">§</a>Differences with fully compiled DFAs</h2>
<p>A <a href="regex/struct.Regex.html" title="struct regex_automata::hybrid::regex::Regex"><code>hybrid::regex::Regex</code></a> and a
<a href="../dfa/regex/struct.Regex.html" title="struct regex_automata::dfa::regex::Regex"><code>dfa::regex::Regex</code></a> both have the same capabilities
(and similarly for their underlying DFAs), but they achieve them through
different means. The main difference is that a hybrid or “lazy” regex builds
its DFA lazily during search, where as a fully compiled regex will build its
DFA at construction time. While building a DFA at search time might sound like
its slow, it tends to work out where most bytes seen during a search will
reuse pre-built parts of the DFA and thus can be almost as fast as a fully
compiled DFA. The main downside is that searching requires mutable space to
store the DFA, and, in the worst case, a search can result in a new state being
created for each byte seen, which would make searching quite a bit slower.</p>
<p>A fully compiled DFA never has to worry about searches being slower once
its built. (Aside from, say, the transition table being so large that it
is subject to harsh CPU cache effects.) However, of course, building a full
DFA can be quite time consuming and memory hungry. Particularly when large
Unicode character classes are used, which tend to translate into very large
DFAs.</p>
<p>A lazy DFA strikes a nice balance <em>in practice</em>, particularly in the
presence of Unicode mode, by only building what is needed. It avoids the
worst case exponential time complexity of DFA compilation by guaranteeing that
it will only build at most one state per byte searched. While the worst
case here can lead to a very high constant, it will never be exponential.</p>
<h2 id="syntax"><a class="doc-anchor" href="#syntax">§</a>Syntax</h2>
<p>This module supports the same syntax as the <code>regex</code> crate, since they share the
same parser. You can find an exhaustive list of supported syntax in the
<a href="https://docs.rs/regex/1/regex/#syntax">documentation for the <code>regex</code> crate</a>.</p>
<p>There are two things that are not supported by the lazy DFAs in this module:</p>
<ul>
<li>Capturing groups. The DFAs (and <a href="regex/struct.Regex.html" title="struct regex_automata::hybrid::regex::Regex"><code>Regex</code></a>es built on top
of them) can only find the offsets of an entire match, but cannot resolve
the offsets of each capturing group. This is because DFAs do not have the
expressive power necessary. Note that it is okay to build a lazy DFA from an
NFA that contains capture groups. The capture groups will simply be ignored.</li>
<li>Unicode word boundaries. These present particularly difficult challenges for
DFA construction and would result in an explosion in the number of states.
One can enable <a href="dfa/struct.Config.html#method.unicode_word_boundary" title="method regex_automata::hybrid::dfa::Config::unicode_word_boundary"><code>dfa::Config::unicode_word_boundary</code></a> though, which provides
heuristic support for Unicode word boundaries that only works on ASCII text.
Otherwise, one can use <code>(?-u:\b)</code> for an ASCII word boundary, which will work
on any input.</li>
</ul>
<p>There are no plans to lift either of these limitations.</p>
<p>Note that these restrictions are identical to the restrictions on fully
compiled DFAs.</p>
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="dfa/index.html" title="mod regex_automata::hybrid::dfa">dfa</a></dt><dd>Types and routines specific to lazy DFAs.</dd><dt><a class="mod" href="regex/index.html" title="mod regex_automata::hybrid::regex">regex</a></dt><dd>A lazy DFA backed <code>Regex</code>.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.BuildError.html" title="struct regex_automata::hybrid::BuildError">Build<wbr>Error</a></dt><dd>An error that occurs when initial construction of a lazy DFA fails.</dd><dt><a class="struct" href="struct.CacheError.html" title="struct regex_automata::hybrid::CacheError">Cache<wbr>Error</a></dt><dd>An error that occurs when cache usage has become inefficient.</dd><dt><a class="struct" href="struct.LazyStateID.html" title="struct regex_automata::hybrid::LazyStateID">Lazy<wbr>StateID</a></dt><dd>A state identifier specifically tailored for lazy DFAs.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.StartError.html" title="enum regex_automata::hybrid::StartError">Start<wbr>Error</a></dt><dd>An error that can occur when computing the start state for a search.</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1,12 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A lazy DFA backed `Regex`."><title>regex_automata::hybrid::regex - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="regex_automata" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module regex</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../regex_automata/index.html">regex_<wbr>automata</a><span class="version">0.4.14</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module regex</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In regex_<wbr>automata::<wbr>hybrid</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">regex_automata</a>::<wbr><a href="../index.html">hybrid</a></div><h1>Module <span>regex</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/regex_automata/hybrid/regex.rs.html#1-895">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A lazy DFA backed <code>Regex</code>.</p>
<p>This module provides a <a href="struct.Regex.html" title="struct regex_automata::hybrid::regex::Regex"><code>Regex</code></a> backed by a lazy DFA. A <code>Regex</code> implements
convenience routines you might have come to expect, such as finding a match
and iterating over all non-overlapping matches. This <code>Regex</code> type is limited
in its capabilities to what a lazy DFA can provide. Therefore, APIs involving
capturing groups, for example, are not provided.</p>
<p>Internally, a <code>Regex</code> is composed of two DFAs. One is a “forward” DFA that
finds the end offset of a match, where as the other is a “reverse” DFA that
find the start offset of a match.</p>
<p>See the <a href="../index.html" title="mod regex_automata::hybrid">parent module</a> for examples.</p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Builder.html" title="struct regex_automata::hybrid::regex::Builder">Builder</a></dt><dd>A builder for a regex based on a hybrid NFA/DFA.</dd><dt><a class="struct" href="struct.Cache.html" title="struct regex_automata::hybrid::regex::Cache">Cache</a></dt><dd>A cache represents a partially computed forward and reverse DFA.</dd><dt><a class="struct" href="struct.FindMatches.html" title="struct regex_automata::hybrid::regex::FindMatches">Find<wbr>Matches</a></dt><dd>An iterator over all non-overlapping matches for an infallible search.</dd><dt><a class="struct" href="struct.Regex.html" title="struct regex_automata::hybrid::regex::Regex">Regex</a></dt><dd>A regular expression that uses hybrid NFA/DFAs (also called “lazy DFAs”)
for searching.</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["Builder","Cache","FindMatches","Regex"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"enum":["StartError"],"mod":["dfa","regex"],"struct":["BuildError","CacheError","LazyStateID"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../regex_automata/meta/struct.BuildError.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../regex_automata/meta/struct.BuildError.html">../../../regex_automata/meta/struct.BuildError.html</a>...</p>
<script>location.replace("../../../regex_automata/meta/struct.BuildError.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,41 @@
<!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="Provides a regex matcher that composes several other regex matchers automatically."><title>regex_automata::meta - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="regex_automata" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module meta</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../regex_automata/index.html">regex_<wbr>automata</a><span class="version">0.4.14</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module meta</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#comparison-with-the-regex-crate" title="Comparison with the `regex` crate">Comparison with the <code>regex</code> crate</a></li></ul><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate regex_<wbr>automata</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">regex_automata</a></div><h1>Module <span>meta</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/regex_automata/meta/mod.rs.html#1-62">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Provides a regex matcher that composes several other regex matchers
automatically.</p>
<p>This module is home to a meta <a href="struct.Regex.html" title="struct regex_automata::meta::Regex"><code>Regex</code></a>, which provides a convenient high
level API for executing regular expressions in linear time.</p>
<h2 id="comparison-with-the-regex-crate"><a class="doc-anchor" href="#comparison-with-the-regex-crate">§</a>Comparison with the <code>regex</code> crate</h2>
<p>A meta <code>Regex</code> is the implementation used directly by the <code>regex</code> crate.
Indeed, the <code>regex</code> crate API is essentially just a light wrapper over a meta
<code>Regex</code>. This means that if you need the full flexibility offered by this
API, then you should be able to switch to using this API directly without
any changes in match semantics or syntax. However, there are some API level
differences:</p>
<ul>
<li>The <code>regex</code> crate API returns match objects that include references to the
haystack itself, which in turn makes it easy to access the matching strings
without having to slice the haystack yourself. In contrast, a meta <code>Regex</code>
returns match objects that only have offsets in them.</li>
<li>At time of writing, a meta <code>Regex</code> doesnt have some of the convenience
routines that the <code>regex</code> crate has, such as replacements. Note though that
<a href="../util/captures/struct.Captures.html#method.interpolate_string" title="method regex_automata::util::captures::Captures::interpolate_string"><code>Captures::interpolate_string</code></a>
will handle the replacement string interpolation for you.</li>
<li>A meta <code>Regex</code> supports the <a href="../struct.Input.html" title="struct regex_automata::Input"><code>Input</code></a> abstraction, which
provides a way to configure a search in more ways than is supported by the
<code>regex</code> crate. For example, <a href="../struct.Input.html#method.anchored" title="method regex_automata::Input::anchored"><code>Input::anchored</code></a> can
be used to run an anchored search, regardless of whether the pattern is itself
anchored with a <code>^</code>.</li>
<li>A meta <code>Regex</code> supports multi-pattern searching everywhere.
Indeed, every <a href="../struct.Match.html" title="struct regex_automata::Match"><code>Match</code></a> returned by the search APIs
include a <a href="../struct.PatternID.html" title="struct regex_automata::PatternID"><code>PatternID</code></a> indicating which pattern
matched. In the single pattern case, all matches correspond to
<a href="../struct.PatternID.html#associatedconstant.ZERO" title="associated constant regex_automata::PatternID::ZERO"><code>PatternID::ZERO</code></a>. In contrast, the <code>regex</code> crate
has distinct <code>Regex</code> and a <code>RegexSet</code> APIs. The former only supports a single
pattern, while the latter supports multiple patterns but cannot report the
offsets of a match.</li>
<li>A meta <code>Regex</code> provides the explicit capability of bypassing its internal
memory pool for automatically acquiring mutable scratch space required by its
internal regex engines. Namely, a <a href="struct.Cache.html" title="struct regex_automata::meta::Cache"><code>Cache</code></a> can be explicitly provided to lower
level routines such as <a href="struct.Regex.html#method.search_with" title="method regex_automata::meta::Regex::search_with"><code>Regex::search_with</code></a>.</li>
</ul>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.BuildError.html" title="struct regex_automata::meta::BuildError">Build<wbr>Error</a></dt><dd>An error that occurs when construction of a <code>Regex</code> fails.</dd><dt><a class="struct" href="struct.Builder.html" title="struct regex_automata::meta::Builder">Builder</a></dt><dd>A builder for configuring and constructing a <code>Regex</code>.</dd><dt><a class="struct" href="struct.Cache.html" title="struct regex_automata::meta::Cache">Cache</a></dt><dd>Represents mutable scratch space used by regex engines during a search.</dd><dt><a class="struct" href="struct.CapturesMatches.html" title="struct regex_automata::meta::CapturesMatches">Captures<wbr>Matches</a></dt><dd>An iterator over all non-overlapping leftmost matches with their capturing
groups.</dd><dt><a class="struct" href="struct.Config.html" title="struct regex_automata::meta::Config">Config</a></dt><dd>An object describing the configuration of a <code>Regex</code>.</dd><dt><a class="struct" href="struct.FindMatches.html" title="struct regex_automata::meta::FindMatches">Find<wbr>Matches</a></dt><dd>An iterator over all non-overlapping matches.</dd><dt><a class="struct" href="struct.Regex.html" title="struct regex_automata::meta::Regex">Regex</a></dt><dd>A regex matcher that works by composing several other regex matchers
automatically.</dd><dt><a class="struct" href="struct.Split.html" title="struct regex_automata::meta::Split">Split</a></dt><dd>Yields all substrings delimited by a regular expression match.</dd><dt><a class="struct" href="struct.SplitN.html" title="struct regex_automata::meta::SplitN">SplitN</a></dt><dd>Yields at most <code>N</code> spans delimited by a regular expression match.</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../regex_automata/meta/struct.Builder.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../regex_automata/meta/struct.Builder.html">../../../regex_automata/meta/struct.Builder.html</a>...</p>
<script>location.replace("../../../regex_automata/meta/struct.Builder.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../regex_automata/meta/struct.Cache.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../regex_automata/meta/struct.Cache.html">../../../regex_automata/meta/struct.Cache.html</a>...</p>
<script>location.replace("../../../regex_automata/meta/struct.Cache.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../regex_automata/meta/struct.CapturesMatches.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../regex_automata/meta/struct.CapturesMatches.html">../../../regex_automata/meta/struct.CapturesMatches.html</a>...</p>
<script>location.replace("../../../regex_automata/meta/struct.CapturesMatches.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../regex_automata/meta/struct.Config.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../regex_automata/meta/struct.Config.html">../../../regex_automata/meta/struct.Config.html</a>...</p>
<script>location.replace("../../../regex_automata/meta/struct.Config.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../regex_automata/meta/struct.FindMatches.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../regex_automata/meta/struct.FindMatches.html">../../../regex_automata/meta/struct.FindMatches.html</a>...</p>
<script>location.replace("../../../regex_automata/meta/struct.FindMatches.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../regex_automata/meta/struct.Regex.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../regex_automata/meta/struct.Regex.html">../../../regex_automata/meta/struct.Regex.html</a>...</p>
<script>location.replace("../../../regex_automata/meta/struct.Regex.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../regex_automata/meta/struct.Split.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../regex_automata/meta/struct.Split.html">../../../regex_automata/meta/struct.Split.html</a>...</p>
<script>location.replace("../../../regex_automata/meta/struct.Split.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../regex_automata/meta/struct.SplitN.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../regex_automata/meta/struct.SplitN.html">../../../regex_automata/meta/struct.SplitN.html</a>...</p>
<script>location.replace("../../../regex_automata/meta/struct.SplitN.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["BuildError","Builder","Cache","CapturesMatches","Config","FindMatches","Regex","Split","SplitN"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,48 @@
<!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="Provides non-deterministic finite automata (NFA) and regex engines that use them."><title>regex_automata::nfa - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="regex_automata" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module nfa</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../regex_automata/index.html">regex_<wbr>automata</a><span class="version">0.4.14</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module nfa</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#why-only-a-thompson-nfa" title="Why only a Thompson NFA?">Why only a Thompson NFA?</a></li></ul><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate regex_<wbr>automata</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">regex_automata</a></div><h1>Module <span>nfa</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/regex_automata/nfa/mod.rs.html#1-55">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Provides non-deterministic finite automata (NFA) and regex engines that use
them.</p>
<p>While NFAs and DFAs (deterministic finite automata) have equivalent <em>theoretical</em>
power, their usage in practice tends to result in different engineering trade
offs. While this isnt meant to be a comprehensive treatment of the topic, here
are a few key trade offs that are, at minimum, true for this crate:</p>
<ul>
<li>NFAs tend to be represented sparsely where as DFAs are represented densely.
Sparse representations use less memory, but are slower to traverse. Conversely,
dense representations use more memory, but are faster to traverse. (Sometimes
these lines are blurred. For example, an <code>NFA</code> might choose to represent a
particular state in a dense fashion, and a DFA can be built using a sparse
representation via <a href="../dfa/sparse/struct.DFA.html" title="struct regex_automata::dfa::sparse::DFA"><code>sparse::DFA</code></a>.</li>
<li>NFAs have epsilon transitions and DFAs dont. In practice, this means that
handling a single byte in a haystack with an NFA at search time may require
visiting multiple NFA states. In a DFA, each byte only requires visiting
a single state. Stated differently, NFAs require a variable number of CPU
instructions to process one byte in a haystack where as a DFA uses a constant
number of CPU instructions to process one byte.</li>
<li>NFAs are generally easier to amend with secondary storage. For example, the
<a href="thompson/pikevm/struct.PikeVM.html" title="struct regex_automata::nfa::thompson::pikevm::PikeVM"><code>thompson::pikevm::PikeVM</code></a> uses an NFA to match, but also uses additional
memory beyond the model of a finite state machine to track offsets for matching
capturing groups. Conversely, the most a DFA can do is report the offset (and
pattern ID) at which a match occurred. This is generally why we also compile
DFAs in reverse, so that we can run them after finding the end of a match to
also find the start of a match.</li>
<li>NFAs take worst case linear time to build, but DFAs take worst case
exponential time to build. The <a href="../hybrid/index.html" title="mod regex_automata::hybrid">hybrid NFA/DFA</a> mitigates this
challenge for DFAs in many practical cases.</li>
</ul>
<p>There are likely other differences, but the bottom line is that NFAs tend to be
more memory efficient and give easier opportunities for increasing expressive
power, where as DFAs are faster to search with.</p>
<h2 id="why-only-a-thompson-nfa"><a class="doc-anchor" href="#why-only-a-thompson-nfa">§</a>Why only a Thompson NFA?</h2>
<p>Currently, the only kind of NFA we support in this crate is a <a href="https://en.wikipedia.org/wiki/Thompson%27s_construction">Thompson
NFA</a>. This refers
to a specific construction algorithm that takes the syntax of a regex
pattern and converts it to an NFA. Specifically, it makes gratuitous use of
epsilon transitions in order to keep its structure simple. In exchange, its
construction time is linear in the size of the regex. A Thompson NFA also makes
the guarantee that given any state and a character in a haystack, there is at
most one transition defined for it. (Although there may be many epsilon
transitions.)</p>
<p>Its possible that other types of NFAs will be added in the future, such as a
<a href="https://en.wikipedia.org/wiki/Glushkov%27s_construction_algorithm">Glushkov NFA</a>.
But currently, this crate only provides a Thompson NFA.</p>
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="thompson/index.html" title="mod regex_automata::nfa::thompson">thompson</a></dt><dd>Defines a Thompson NFA and provides the <a href="thompson/pikevm/struct.PikeVM.html" title="struct regex_automata::nfa::thompson::pikevm::PikeVM"><code>PikeVM</code></a> and
<a href="thompson/backtrack/struct.BoundedBacktracker.html" title="struct regex_automata::nfa::thompson::backtrack::BoundedBacktracker"><code>BoundedBacktracker</code></a> regex engines.</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"mod":["thompson"]};

View File

@@ -0,0 +1,13 @@
<!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="Returns the minimum visited capacity for the given haystack."><title>min_visited_capacity in regex_automata::nfa::thompson::backtrack - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../../" data-static-root-path="../../../../static.files/" data-current-crate="regex_automata" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">min_visited_capacity</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../regex_automata/index.html">regex_<wbr>automata</a><span class="version">0.4.14</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In regex_<wbr>automata::<wbr>nfa::<wbr>thompson::<wbr>backtrack</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../index.html">regex_automata</a>::<wbr><a href="../../index.html">nfa</a>::<wbr><a href="../index.html">thompson</a>::<wbr><a href="index.html">backtrack</a></div><h1>Function <span class="fn">min_<wbr>visited_<wbr>capacity</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../../src/regex_automata/nfa/thompson/backtrack.rs.html#41-43">Source</a> </span></div><pre class="rust item-decl"><code>pub fn min_visited_capacity(nfa: &amp;<a class="struct" href="../struct.NFA.html" title="struct regex_automata::nfa::thompson::NFA">NFA</a>, input: &amp;<a class="struct" href="../../../struct.Input.html" title="struct regex_automata::Input">Input</a>&lt;'_&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns the minimum visited capacity for the given haystack.</p>
<p>This function can be used as the argument to <a href="struct.Config.html#method.visited_capacity" title="method regex_automata::nfa::thompson::backtrack::Config::visited_capacity"><code>Config::visited_capacity</code></a>
in order to guarantee that a backtracking search for the given <code>input</code>
wont return an error when using a <a href="struct.BoundedBacktracker.html" title="struct regex_automata::nfa::thompson::backtrack::BoundedBacktracker"><code>BoundedBacktracker</code></a> built from the
given <code>NFA</code>.</p>
<p>This routine exists primarily as a way to test that the bounded backtracker
works correctly when its capacity is set to the smallest possible amount.
Still, it may be useful in cases where you know you want to use the bounded
backtracker for a specific input, and just need to know what visited
capacity to provide to make it work.</p>
<p>Be warned that this number could be quite large as it is multiplicative in
the size the given NFA and haystack.</p>
</div></details></section></div></main></body></html>

View File

@@ -0,0 +1,12 @@
<!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="An NFA backed bounded backtracker for executing regex searches with capturing groups."><title>regex_automata::nfa::thompson::backtrack - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../../" data-static-root-path="../../../../static.files/" data-current-crate="regex_automata" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module backtrack</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../regex_automata/index.html">regex_<wbr>automata</a><span class="version">0.4.14</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module backtrack</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In regex_<wbr>automata::<wbr>nfa::<wbr>thompson</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../index.html">regex_automata</a>::<wbr><a href="../../index.html">nfa</a>::<wbr><a href="../index.html">thompson</a></div><h1>Module <span>backtrack</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../../src/regex_automata/nfa/thompson/backtrack.rs.html#1-1908">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An NFA backed bounded backtracker for executing regex searches with capturing
groups.</p>
<p>This module provides a <a href="struct.BoundedBacktracker.html" title="struct regex_automata::nfa::thompson::backtrack::BoundedBacktracker"><code>BoundedBacktracker</code></a> that works by simulating an NFA
using the classical backtracking algorithm with a twist: it avoids redoing
work that it has done before and thereby avoids worst case exponential time.
In exchange, it can only be used on “short” haystacks. Its advantage is that
is can be faster than the <a href="../pikevm/struct.PikeVM.html" title="struct regex_automata::nfa::thompson::pikevm::PikeVM"><code>PikeVM</code></a> in many cases
because it does less book-keeping.</p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.BoundedBacktracker.html" title="struct regex_automata::nfa::thompson::backtrack::BoundedBacktracker">Bounded<wbr>Backtracker</a></dt><dd>A backtracking regex engine that bounds its execution to avoid exponential
blow-up.</dd><dt><a class="struct" href="struct.Builder.html" title="struct regex_automata::nfa::thompson::backtrack::Builder">Builder</a></dt><dd>A builder for a bounded backtracker.</dd><dt><a class="struct" href="struct.Cache.html" title="struct regex_automata::nfa::thompson::backtrack::Cache">Cache</a></dt><dd>A cache represents mutable state that a <a href="struct.BoundedBacktracker.html" title="struct regex_automata::nfa::thompson::backtrack::BoundedBacktracker"><code>BoundedBacktracker</code></a> requires
during a search.</dd><dt><a class="struct" href="struct.Config.html" title="struct regex_automata::nfa::thompson::backtrack::Config">Config</a></dt><dd>The configuration used for building a bounded backtracker.</dd><dt><a class="struct" href="struct.TryCapturesMatches.html" title="struct regex_automata::nfa::thompson::backtrack::TryCapturesMatches">TryCaptures<wbr>Matches</a></dt><dd>An iterator over all non-overlapping leftmost matches, with their capturing
groups, for a fallible search.</dd><dt><a class="struct" href="struct.TryFindMatches.html" title="struct regex_automata::nfa::thompson::backtrack::TryFindMatches">TryFind<wbr>Matches</a></dt><dd>An iterator over all non-overlapping matches for a fallible search.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.min_visited_capacity.html" title="fn regex_automata::nfa::thompson::backtrack::min_visited_capacity">min_<wbr>visited_<wbr>capacity</a></dt><dd>Returns the minimum visited capacity for the given haystack.</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"fn":["min_visited_capacity"],"struct":["BoundedBacktracker","Builder","Cache","Config","TryCapturesMatches","TryFindMatches"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../../regex_automata/nfa/thompson/struct.Builder.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../../regex_automata/nfa/thompson/struct.Builder.html">../../../../regex_automata/nfa/thompson/struct.Builder.html</a>...</p>
<script>location.replace("../../../../regex_automata/nfa/thompson/struct.Builder.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../../regex_automata/nfa/thompson/enum.WhichCaptures.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../../regex_automata/nfa/thompson/enum.WhichCaptures.html">../../../../regex_automata/nfa/thompson/enum.WhichCaptures.html</a>...</p>
<script>location.replace("../../../../regex_automata/nfa/thompson/enum.WhichCaptures.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../../regex_automata/nfa/thompson/struct.Compiler.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../../regex_automata/nfa/thompson/struct.Compiler.html">../../../../regex_automata/nfa/thompson/struct.Compiler.html</a>...</p>
<script>location.replace("../../../../regex_automata/nfa/thompson/struct.Compiler.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../../regex_automata/nfa/thompson/struct.Config.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../../regex_automata/nfa/thompson/struct.Config.html">../../../../regex_automata/nfa/thompson/struct.Config.html</a>...</p>
<script>location.replace("../../../../regex_automata/nfa/thompson/struct.Config.html" + location.search + location.hash);</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../../regex_automata/nfa/thompson/struct.BuildError.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../../regex_automata/nfa/thompson/struct.BuildError.html">../../../../regex_automata/nfa/thompson/struct.BuildError.html</a>...</p>
<script>location.replace("../../../../regex_automata/nfa/thompson/struct.BuildError.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,57 @@
<!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="Defines a Thompson NFA and provides the `PikeVM` and `BoundedBacktracker` regex engines."><title>regex_automata::nfa::thompson - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="regex_automata" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module thompson</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../regex_automata/index.html">regex_<wbr>automata</a><span class="version">0.4.14</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module thompson</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#details" title="Details">Details</a></li></ul><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In regex_<wbr>automata::<wbr>nfa</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">regex_automata</a>::<wbr><a href="../index.html">nfa</a></div><h1>Module <span>thompson</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/regex_automata/nfa/thompson/mod.rs.html#1-81">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Defines a Thompson NFA and provides the <a href="pikevm/struct.PikeVM.html" title="struct regex_automata::nfa::thompson::pikevm::PikeVM"><code>PikeVM</code></a> and
<a href="backtrack/struct.BoundedBacktracker.html" title="struct regex_automata::nfa::thompson::backtrack::BoundedBacktracker"><code>BoundedBacktracker</code></a> regex engines.</p>
<p>A Thompson NFA (non-deterministic finite automaton) is arguably <em>the</em> central
data type in this library. It is the result of what is commonly referred to as
“regex compilation.” That is, turning a regex pattern from its concrete syntax
string into something that can run a search looks roughly like this:</p>
<ul>
<li>A <code>&amp;str</code> is parsed into a <a href="../../../regex_syntax/ast/enum.Ast.html" title="enum regex_syntax::ast::Ast"><code>regex-syntax::ast::Ast</code></a>.</li>
<li>An <code>Ast</code> is translated into a <a href="../../../regex_syntax/hir/struct.Hir.html" title="struct regex_syntax::hir::Hir"><code>regex-syntax::hir::Hir</code></a>.</li>
<li>An <code>Hir</code> is compiled into a <a href="struct.NFA.html" title="struct regex_automata::nfa::thompson::NFA"><code>NFA</code></a>.</li>
<li>The <code>NFA</code> is then used to build one of a few different regex engines:
<ul>
<li>An <code>NFA</code> is used directly in the <code>PikeVM</code> and <code>BoundedBacktracker</code> engines.</li>
<li>An <code>NFA</code> is used by a <a href="../../hybrid/index.html" title="mod regex_automata::hybrid">hybrid NFA/DFA</a> to build out a DFAs
transition table at search time.</li>
<li>An <code>NFA</code>, assuming it is one-pass, is used to build a full
<a href="../../dfa/onepass/index.html" title="mod regex_automata::dfa::onepass">one-pass DFA</a> ahead of time.</li>
<li>An <code>NFA</code> is used to build a <a href="../../dfa/index.html" title="mod regex_automata::dfa">full DFA</a> ahead of time.</li>
</ul>
</li>
</ul>
<p>The <a href="../../meta/index.html" title="mod regex_automata::meta"><code>meta</code></a> regex engine makes all of these choices for you based
on various criteria. However, if you have a lower level use case, <em>you</em> can
build any of the above regex engines and use them directly. But you must start
here by building an <code>NFA</code>.</p>
<h2 id="details"><a class="doc-anchor" href="#details">§</a>Details</h2>
<p>It is perhaps worth expanding a bit more on what it means to go through the
<code>&amp;str</code>-&gt;<code>Ast</code>-&gt;<code>Hir</code>-&gt;<code>NFA</code> process.</p>
<ul>
<li>Parsing a string into an <code>Ast</code> gives it a structured representation.
Crucially, the size and amount of work done in this step is proportional to the
size of the original string. No optimization or Unicode handling is done at
this point. This means that parsing into an <code>Ast</code> has very predictable costs.
Moreover, an <code>Ast</code> can be round-tripped back to its original pattern string as
written.</li>
<li>Translating an <code>Ast</code> into an <code>Hir</code> is a process by which the structured
representation is simplified down to its most fundamental components.
Translation deals with flags such as case insensitivity by converting things
like <code>(?i:a)</code> to <code>[Aa]</code>. Translation is also where Unicode tables are consulted
to resolve things like <code>\p{Emoji}</code> and <code>\p{Greek}</code>. It also flattens each
character class, regardless of how deeply nested it is, into a single sequence
of non-overlapping ranges. All the various literal forms are thrown out in
favor of one common representation. Overall, the <code>Hir</code> is small enough to fit
into your head and makes analysis and other tasks much simpler.</li>
<li>Compiling an <code>Hir</code> into an <code>NFA</code> formulates the regex into a finite state
machine whose transitions are defined over bytes. For example, an <code>Hir</code> might
have a Unicode character class corresponding to a sequence of ranges defined
in terms of <code>char</code>. Compilation is then responsible for turning those ranges
into a UTF-8 automaton. That is, an automaton that matches the UTF-8 encoding
of just the codepoints specified by those ranges. Otherwise, the main job of
an <code>NFA</code> is to serve as a byte-code of sorts for a virtual machine. It can be
seen as a sequence of instructions for how to match a regex.</li>
</ul>
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="backtrack/index.html" title="mod regex_automata::nfa::thompson::backtrack">backtrack</a></dt><dd>An NFA backed bounded backtracker for executing regex searches with capturing
groups.</dd><dt><a class="mod" href="pikevm/index.html" title="mod regex_automata::nfa::thompson::pikevm">pikevm</a></dt><dd>An NFA backed Pike VM for executing regex searches with capturing groups.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.BuildError.html" title="struct regex_automata::nfa::thompson::BuildError">Build<wbr>Error</a></dt><dd>An error that can occurred during the construction of a thompson NFA.</dd><dt><a class="struct" href="struct.Builder.html" title="struct regex_automata::nfa::thompson::Builder">Builder</a></dt><dd>An abstraction for building Thompson NFAs by hand.</dd><dt><a class="struct" href="struct.Compiler.html" title="struct regex_automata::nfa::thompson::Compiler">Compiler</a></dt><dd>A builder for compiling an NFA from a regexs high-level intermediate
representation (HIR).</dd><dt><a class="struct" href="struct.Config.html" title="struct regex_automata::nfa::thompson::Config">Config</a></dt><dd>The configuration used for a Thompson NFA compiler.</dd><dt><a class="struct" href="struct.DenseTransitions.html" title="struct regex_automata::nfa::thompson::DenseTransitions">Dense<wbr>Transitions</a></dt><dd>A sequence of transitions used to represent a dense state.</dd><dt><a class="struct" href="struct.NFA.html" title="struct regex_automata::nfa::thompson::NFA">NFA</a></dt><dd>A byte oriented Thompson non-deterministic finite automaton (NFA).</dd><dt><a class="struct" href="struct.PatternIter.html" title="struct regex_automata::nfa::thompson::PatternIter">Pattern<wbr>Iter</a></dt><dd>An iterator over all pattern IDs in an NFA.</dd><dt><a class="struct" href="struct.SparseTransitions.html" title="struct regex_automata::nfa::thompson::SparseTransitions">Sparse<wbr>Transitions</a></dt><dd>A sequence of transitions used to represent a sparse state.</dd><dt><a class="struct" href="struct.Transition.html" title="struct regex_automata::nfa::thompson::Transition">Transition</a></dt><dd>A single transition to another state.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.State.html" title="enum regex_automata::nfa::thompson::State">State</a></dt><dd>A state in an NFA.</dd><dt><a class="enum" href="enum.WhichCaptures.html" title="enum regex_automata::nfa::thompson::WhichCaptures">Which<wbr>Captures</a></dt><dd>A configuration indicating which kinds of
<a href="enum.State.html#variant.Capture" title="variant regex_automata::nfa::thompson::State::Capture"><code>State::Capture</code></a> states to include.</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../../regex_automata/nfa/thompson/enum.State.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../../regex_automata/nfa/thompson/enum.State.html">../../../../regex_automata/nfa/thompson/enum.State.html</a>...</p>
<script>location.replace("../../../../regex_automata/nfa/thompson/enum.State.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../../regex_automata/nfa/thompson/struct.DenseTransitions.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../../regex_automata/nfa/thompson/struct.DenseTransitions.html">../../../../regex_automata/nfa/thompson/struct.DenseTransitions.html</a>...</p>
<script>location.replace("../../../../regex_automata/nfa/thompson/struct.DenseTransitions.html" + location.search + location.hash);</script>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More