Skip to main content

dfa_pack

Function dfa_pack 

Source
pub fn dfa_pack(dfa: &Dfa, format: DfaPackFormat) -> PackedDfa
Expand description

Pack a DFA into GPU-uploadable bytes using the selected format.

ยงExamples

use vyre_std::pattern::{regex_to_nfa::regex_to_nfa, nfa_to_dfa::nfa_to_dfa, dfa_minimize::dfa_minimize, dfa_pack::dfa_pack, types::DfaPackFormat};

let nfa = regex_to_nfa("foo|bar").unwrap();
let dfa = dfa_minimize(&nfa_to_dfa(&nfa).unwrap());
let packed = dfa_pack(&dfa, DfaPackFormat::Dense);
assert!(!packed.bytes.is_empty());