@@ -3,13 +3,12 @@ Types and routines specific to sparse DFAs.
33
44This module is the home of [`sparse::DFA`](DFA).
55
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:
1312
1413```
1514use regex_automata::{
@@ -74,18 +73,17 @@ const VERSION: u32 = 2;
7473
7574/// A sparse deterministic finite automaton (DFA) with variable sized states.
7675///
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.
8382///
8483/// 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`].
8987///
9088/// In general, a sparse DFA supports all the same search operations as a dense
9189/// DFA.
@@ -140,11 +138,9 @@ impl DFA<Vec<u8>> {
140138 /// Parse the given regular expression using a default configuration and
141139 /// return the corresponding sparse DFA.
142140 ///
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.
148144 ///
149145 /// # Example
150146 ///
@@ -167,11 +163,9 @@ impl DFA<Vec<u8>> {
167163 /// Parse the given regular expressions using a default configuration and
168164 /// return the corresponding multi-DFA.
169165 ///
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.
175169 ///
176170 /// # Example
177171 ///
@@ -511,10 +505,9 @@ impl<T: AsRef<[u8]>> DFA<T> {
511505 /// * [`DFA::from_bytes`]
512506 /// * [`DFA::from_bytes_unchecked`]
513507 ///
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.
518511 ///
519512 /// # Example
520513 ///
@@ -553,10 +546,9 @@ impl<T: AsRef<[u8]>> DFA<T> {
553546 /// * [`DFA::from_bytes`]
554547 /// * [`DFA::from_bytes_unchecked`]
555548 ///
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.
560552 ///
561553 /// # Example
562554 ///
@@ -595,10 +587,9 @@ impl<T: AsRef<[u8]>> DFA<T> {
595587 /// * [`DFA::from_bytes`]
596588 /// * [`DFA::from_bytes_unchecked`]
597589 ///
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.
602593 ///
603594 /// Generally speaking, native endian format should only be used when
604595 /// you know that the target you're compiling the DFA for matches the
@@ -903,9 +894,9 @@ impl<'a> DFA<&'a [u8]> {
903894 ///
904895 /// If any of the above are not true, then an error will be returned.
905896 ///
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.
909900 ///
910901 /// # Panics
911902 ///
0 commit comments