#[non_exhaustive]pub struct GpuDfa { /* private fields */ }Expand description
A GPU-compiled DFA scanner.
Implementations§
Source§impl GpuDfa
impl GpuDfa
Sourcepub fn compile(
device: &Device,
transitions: &[u32],
state_count: usize,
accept_states: &[(u32, u32)],
output_links: &[u32],
pattern_lengths: &[u32],
) -> Result<Self>
pub fn compile( device: &Device, transitions: &[u32], state_count: usize, accept_states: &[(u32, u32)], output_links: &[u32], pattern_lengths: &[u32], ) -> Result<Self>
Internal pipeline helper. User-facing DFA construction lives in
std::pattern::aho_corasick_build.
§Errors
Returns Error::Dfa when the table, output links, or bindings are invalid.
Sourcepub fn compile_with_max_matches(
device: &Device,
transitions: &[u32],
state_count: usize,
accept_states: &[(u32, u32)],
output_links: &[u32],
pattern_lengths: &[u32],
max_matches: u32,
) -> Result<Self>
pub fn compile_with_max_matches( device: &Device, transitions: &[u32], state_count: usize, accept_states: &[(u32, u32)], output_links: &[u32], pattern_lengths: &[u32], max_matches: u32, ) -> Result<Self>
Internal pipeline helper. User-facing DFA construction lives in
std::pattern::aho_corasick_build.
§Errors
Returns Error::Dfa when validation of the DFA or GPU binding sizes fails.
Sourcepub fn scan(
&self,
device: &Device,
queue: &Queue,
input: &[u8],
command_encoder: Option<&mut CommandEncoder>,
) -> Result<Vec<Match>>
pub fn scan( &self, device: &Device, queue: &Queue, input: &[u8], command_encoder: Option<&mut CommandEncoder>, ) -> Result<Vec<Match>>
Scan input bytes on the GPU and return captured matches.
§Errors
Returns Error::Dfa if the input, device, queue, or readback is invalid.
Scan input bytes using the shared vyre device.
§Errors
Returns Error::Dfa if this DFA was not compiled on the shared runtime device.
Sourcepub fn state_count(&self) -> u32
pub fn state_count(&self) -> u32
Number of DFA states in the compiled scanner.
Sourcepub fn max_matches(&self) -> u32
pub fn max_matches(&self) -> u32
Maximum number of matches this scanner captures.
Sourcepub fn pattern_lengths(&self) -> &[u32]
pub fn pattern_lengths(&self) -> &[u32]
Pattern lengths supplied at compile time.