1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#[cfg(not(all(feature = "std", target_arch = "x86_64")))]
pub use crate::packed::teddy::fallback::{Builder, Teddy};
#[cfg(all(feature = "std", target_arch = "x86_64"))]
pub use crate::packed::teddy::{compile::Builder, runtime::Teddy};

#[cfg(all(feature = "std", target_arch = "x86_64"))]
mod compile;
#[cfg(all(feature = "std", target_arch = "x86_64"))]
mod runtime;

#[cfg(not(all(feature = "std", target_arch = "x86_64")))]
mod fallback {
    use crate::{packed::pattern::Patterns, Match};

    #[derive(Clone, Debug, Default)]
    pub struct Builder(());

    impl Builder {
        pub fn new() -> Builder {
            Builder(())
        }

        pub fn build(&self, _: &Patterns) -> Option<Teddy> {
            None
        }

        pub fn fat(&mut self, _: Option<bool>) -> &mut Builder {
            self
        }

        pub fn avx(&mut self, _: Option<bool>) -> &mut Builder {
            self
        }
    }

    #[derive(Clone, Debug)]
    pub struct Teddy(());

    impl Teddy {
        pub fn find_at(
            &self,
            _: &Patterns,
            _: &[u8],
            _: usize,
        ) -> Option<Match> {
            None
        }

        pub fn minimum_len(&self) -> usize {
            0
        }

        pub fn memory_usage(&self) -> usize {
            0
        }
    }
}