rsonpath/classification/
memmem.rs1use crate::{
4 input::{error::InputError, Input},
5 result::InputRecorder,
6 string_pattern::StringPattern,
7 BLOCK_SIZE,
8};
9
10pub trait Memmem<'i, 'b, 'r, I: Input, const N: usize> {
12 fn find_label(
22 &mut self,
23 first_block: Option<I::Block<'i, N>>,
24 start_idx: usize,
25 label: &StringPattern,
26 ) -> Result<Option<(usize, I::Block<'i, N>)>, InputError>;
27}
28
29pub(crate) mod nosimd;
30pub(crate) mod shared;
31
32#[cfg(target_arch = "x86")]
33pub(crate) mod avx2_32;
34#[cfg(target_arch = "x86_64")]
35pub(crate) mod avx2_64;
36#[cfg(target_arch = "x86_64")]
37pub(crate) mod avx512_64;
38#[cfg(target_arch = "aarch64")]
39pub(crate) mod neon_64;
40#[cfg(target_arch = "x86")]
41pub(crate) mod sse2_32;
42#[cfg(target_arch = "x86_64")]
43pub(crate) mod sse2_64;
44
45pub(crate) trait MemmemImpl {
46 type Classifier<'i, 'b, 'r, I, R>: Memmem<'i, 'b, 'r, I, BLOCK_SIZE>
47 where
48 I: Input + 'i,
49 <I as Input>::BlockIterator<'i, 'r, R, BLOCK_SIZE>: 'b,
50 R: InputRecorder<<I as Input>::Block<'i, BLOCK_SIZE>> + 'r,
51 'i: 'r;
52
53 fn memmem<'i, 'b, 'r, I, R>(
54 input: &'i I,
55 iter: &'b mut <I as Input>::BlockIterator<'i, 'r, R, BLOCK_SIZE>,
56 ) -> Self::Classifier<'i, 'b, 'r, I, R>
57 where
58 I: Input,
59 R: InputRecorder<<I as Input>::Block<'i, BLOCK_SIZE>>,
60 'i: 'r;
61}