@@ -3,13 +3,12 @@ Types and routines specific to sparse DFAs.
3
3
4
4
This module is the home of [`sparse::DFA`](DFA).
5
5
6
- Unlike the [`dense`](super::dense) module, this module does not contain a
7
- builder or configuration specific for sparse DFAs. Instead, the intended
8
- way to build a sparse DFA is either by using a default configuration with
9
- its constructor [`sparse::DFA::new`](DFA::new), or by first configuring the
10
- construction of a dense DFA with [`dense::Builder`](super::dense::Builder)
11
- and then calling [`dense::DFA::to_sparse`](super::dense::DFA::to_sparse). For
12
- example, this configures a sparse DFA to do an overlapping search:
6
+ Unlike the [`dense`] module, this module does not contain a builder or
7
+ configuration specific for sparse DFAs. Instead, the intended way to build a
8
+ sparse DFA is either by using a default configuration with its constructor
9
+ [`sparse::DFA::new`](DFA::new), or by first configuring the construction of a
10
+ dense DFA with [`dense::Builder`] and then calling [`dense::DFA::to_sparse`].
11
+ For example, this configures a sparse DFA to do an overlapping search:
13
12
14
13
```
15
14
use regex_automata::{
@@ -74,18 +73,17 @@ const VERSION: u32 = 2;
74
73
75
74
/// A sparse deterministic finite automaton (DFA) with variable sized states.
76
75
///
77
- /// In contrast to a [dense::DFA](crate::dfa::dense::DFA) , a sparse DFA uses
78
- /// a more space efficient representation for its transitions. Consequently,
79
- /// sparse DFAs may use much less memory than dense DFAs, but this comes at a
80
- /// price. In particular, reading the more space efficient transitions takes
81
- /// more work, and consequently, searching using a sparse DFA is typically
82
- /// slower than a dense DFA.
76
+ /// In contrast to a [dense::DFA], a sparse DFA uses a more space efficient
77
+ /// representation for its transitions. Consequently, sparse DFAs may use much
78
+ /// less memory than dense DFAs, but this comes at a price. In particular,
79
+ /// reading the more space efficient transitions takes more work, and
80
+ /// consequently, searching using a sparse DFA is typically slower than a dense
81
+ /// DFA.
83
82
///
84
83
/// A sparse DFA can be built using the default configuration via the
85
- /// [`DFA::new`] constructor. Otherwise, one can configure various aspects
86
- /// of a dense DFA via [`dense::Builder`](crate::dfa::dense::Builder),
87
- /// and then convert a dense DFA to a sparse DFA using
88
- /// [`dense::DFA::to_sparse`](crate::dfa::dense::DFA::to_sparse).
84
+ /// [`DFA::new`] constructor. Otherwise, one can configure various aspects of a
85
+ /// dense DFA via [`dense::Builder`], and then convert a dense DFA to a sparse
86
+ /// DFA using [`dense::DFA::to_sparse`].
89
87
///
90
88
/// In general, a sparse DFA supports all the same search operations as a dense
91
89
/// DFA.
@@ -140,11 +138,9 @@ impl DFA<Vec<u8>> {
140
138
/// Parse the given regular expression using a default configuration and
141
139
/// return the corresponding sparse DFA.
142
140
///
143
- /// If you want a non-default configuration, then use
144
- /// the [`dense::Builder`](crate::dfa::dense::Builder)
145
- /// to set your own configuration, and then call
146
- /// [`dense::DFA::to_sparse`](crate::dfa::dense::DFA::to_sparse) to create
147
- /// a sparse DFA.
141
+ /// If you want a non-default configuration, then use the
142
+ /// [`dense::Builder`] to set your own configuration, and then call
143
+ /// [`dense::DFA::to_sparse`] to create a sparse DFA.
148
144
///
149
145
/// # Example
150
146
///
@@ -167,11 +163,9 @@ impl DFA<Vec<u8>> {
167
163
/// Parse the given regular expressions using a default configuration and
168
164
/// return the corresponding multi-DFA.
169
165
///
170
- /// If you want a non-default configuration, then use
171
- /// the [`dense::Builder`](crate::dfa::dense::Builder)
172
- /// to set your own configuration, and then call
173
- /// [`dense::DFA::to_sparse`](crate::dfa::dense::DFA::to_sparse) to create
174
- /// a sparse DFA.
166
+ /// If you want a non-default configuration, then use the
167
+ /// [`dense::Builder`] to set your own configuration, and then call
168
+ /// [`dense::DFA::to_sparse`] to create a sparse DFA.
175
169
///
176
170
/// # Example
177
171
///
@@ -511,10 +505,9 @@ impl<T: AsRef<[u8]>> DFA<T> {
511
505
/// * [`DFA::from_bytes`]
512
506
/// * [`DFA::from_bytes_unchecked`]
513
507
///
514
- /// Note that unlike a [`dense::DFA`](crate::dfa::dense::DFA)'s
515
- /// serialization methods, this does not add any initial padding to the
516
- /// returned bytes. Padding isn't required for sparse DFAs since they have
517
- /// no alignment requirements.
508
+ /// Note that unlike a [`dense::DFA`]'s serialization methods, this does
509
+ /// not add any initial padding to the returned bytes. Padding isn't
510
+ /// required for sparse DFAs since they have no alignment requirements.
518
511
///
519
512
/// # Example
520
513
///
@@ -553,10 +546,9 @@ impl<T: AsRef<[u8]>> DFA<T> {
553
546
/// * [`DFA::from_bytes`]
554
547
/// * [`DFA::from_bytes_unchecked`]
555
548
///
556
- /// Note that unlike a [`dense::DFA`](crate::dfa::dense::DFA)'s
557
- /// serialization methods, this does not add any initial padding to the
558
- /// returned bytes. Padding isn't required for sparse DFAs since they have
559
- /// no alignment requirements.
549
+ /// Note that unlike a [`dense::DFA`]'s serialization methods, this does
550
+ /// not add any initial padding to the returned bytes. Padding isn't
551
+ /// required for sparse DFAs since they have no alignment requirements.
560
552
///
561
553
/// # Example
562
554
///
@@ -595,10 +587,9 @@ impl<T: AsRef<[u8]>> DFA<T> {
595
587
/// * [`DFA::from_bytes`]
596
588
/// * [`DFA::from_bytes_unchecked`]
597
589
///
598
- /// Note that unlike a [`dense::DFA`](crate::dfa::dense::DFA)'s
599
- /// serialization methods, this does not add any initial padding to the
600
- /// returned bytes. Padding isn't required for sparse DFAs since they have
601
- /// no alignment requirements.
590
+ /// Note that unlike a [`dense::DFA`]'s serialization methods, this does
591
+ /// not add any initial padding to the returned bytes. Padding isn't
592
+ /// required for sparse DFAs since they have no alignment requirements.
602
593
///
603
594
/// Generally speaking, native endian format should only be used when
604
595
/// you know that the target you're compiling the DFA for matches the
@@ -903,9 +894,9 @@ impl<'a> DFA<&'a [u8]> {
903
894
///
904
895
/// If any of the above are not true, then an error will be returned.
905
896
///
906
- /// Note that unlike deserializing a
907
- /// [`dense:: DFA`](crate::dfa::dense::DFA), deserializing a sparse DFA has
908
- /// no alignment requirements. That is, an alignment of `1` is valid.
897
+ /// Note that unlike deserializing a [`dense::DFA`], deserializing a sparse
898
+ /// DFA has no alignment requirements. That is, an alignment of `1` is
899
+ /// valid.
909
900
///
910
901
/// # Panics
911
902
///
0 commit comments