diff --git a/regex-automata/src/dfa/dense.rs b/regex-automata/src/dfa/dense.rs index adcf11b4d..056213b28 100644 --- a/regex-automata/src/dfa/dense.rs +++ b/regex-automata/src/dfa/dense.rs @@ -2469,6 +2469,19 @@ impl<'a> DFA<&'a [u32]> { } } +/// Other routines that work for all `T`. +impl DFA { + /// Set or unset the prefilter attached to this DFA. + /// + /// This is useful when one has deserialized a DFA from `&[u8]`. + /// Deserialization does not currently include prefilters, so if you + /// want prefilter acceleration, you'll need to rebuild it and attach + /// it here. + pub fn set_prefilter(&mut self, prefilter: Option) { + self.pre = prefilter + } +} + // The following methods implement mutable routines on the internal // representation of a DFA. As such, we must fix the first type parameter to a // `Vec` since a generic `T: AsRef<[u32]>` does not permit mutation. We diff --git a/regex-automata/src/dfa/sparse.rs b/regex-automata/src/dfa/sparse.rs index 46278c181..6a94bccc1 100644 --- a/regex-automata/src/dfa/sparse.rs +++ b/regex-automata/src/dfa/sparse.rs @@ -1071,6 +1071,19 @@ impl<'a> DFA<&'a [u8]> { } } +/// Other routines that work for all `T`. +impl DFA { + /// Set or unset the prefilter attached to this DFA. + /// + /// This is useful when one has deserialized a DFA from `&[u8]`. + /// Deserialization does not currently include prefilters, so if you + /// want prefilter acceleration, you'll need to rebuild it and attach + /// it here. + pub fn set_prefilter(&mut self, prefilter: Option) { + self.pre = prefilter + } +} + impl> fmt::Debug for DFA { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { writeln!(f, "sparse::DFA(")?;