Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions regex-automata/src/dfa/dense.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2469,6 +2469,19 @@ impl<'a> DFA<&'a [u32]> {
}
}

/// Other routines that work for all `T`.
impl<T> DFA<T> {
/// 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<Prefilter>) {
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<u32>` since a generic `T: AsRef<[u32]>` does not permit mutation. We
Expand Down
13 changes: 13 additions & 0 deletions regex-automata/src/dfa/sparse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,19 @@ impl<'a> DFA<&'a [u8]> {
}
}

/// Other routines that work for all `T`.
impl<T> DFA<T> {
/// 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<Prefilter>) {
self.pre = prefilter
}
}

impl<T: AsRef<[u8]>> fmt::Debug for DFA<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
writeln!(f, "sparse::DFA(")?;
Expand Down
Loading