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
//! Fuzzy matching and scoring engine.
//!
//! # Quick start
//!
//! ```rust
//! use neek_core::{has_match, score, score_positions};
//!
//! let needle = b"src";
//! let haystack = b"src/main.rs";
//!
//! assert!(has_match(needle, haystack));
//!
//! let s = score(needle, haystack);
//! println!("score: {s}");
//!
//! let mut positions = vec![0usize; needle.len()];
//! let s2 = score_positions(needle, haystack, &mut positions);
//! assert_eq!(s, s2);
//! println!("matched at positions: {:?}", positions);
//! ```
extern crate alloc;
pub use ;
/// Numeric type used for all scores.
pub type Score = f64;
/// Returned when a candidate is an exact (case-insensitive) match for the
/// needle, or when the needle is empty and all candidates match trivially.
pub const SCORE_MAX: Score = f64INFINITY;
/// Returned when a candidate cannot be scored (too long, no match, or the
/// needle is empty at the `score` call site).
pub const SCORE_MIN: Score = f64NEG_INFINITY;
/// Maximum haystack/needle length that the DP scorer handles. Candidates
/// longer than this are given `SCORE_MIN` by `score` / `score_positions`.
pub const MATCH_MAX_LEN: usize = 1024;