Skip to main content

QuickMatchConfig

Struct QuickMatchConfig 

Source
pub struct QuickMatchConfig { /* private fields */ }

Implementations§

Source§

impl QuickMatchConfig

Source

pub fn new() -> Self

Examples found in repository?
examples/colon_test.rs (line 17)
3fn main() {
4    // Case 1: Items with colon, query with colon (default separators)
5    let items = vec!["word: word2", "other: thing", "word word2"];
6    let qm = QuickMatch::new(&items);
7    let results = qm.matches("word: word2");
8    println!("Default seps | query 'word: word2' vs items with colon: {results:?}");
9
10    // Case 2: Query "word:" against items
11    let items2 = vec!["word: word2", "word word2", "word", "word:"];
12    let qm2 = QuickMatch::new(&items2);
13    let results2 = qm2.matches("word:");
14    println!("Default seps | query 'word:' vs mixed items:           {results2:?}");
15
16    // Case 3: Colon as separator, query "word: word2"
17    let config3 = QuickMatchConfig::new().with_separators(&['_', '-', ' ', ':']);
18    let items3 = vec!["word: word2", "other: thing", "word word2"];
19    let qm3 = QuickMatch::new_with(&items3, config3);
20    let results3 = qm3.matches("word: word2");
21    println!("Colon as sep | query 'word: word2':                    {results3:?}");
22
23    // Case 4: Colon as separator, query "word:"
24    let config4 = QuickMatchConfig::new().with_separators(&['_', '-', ' ', ':']);
25    let items4 = vec!["word: word2", "word word2", "word", "word:"];
26    let qm4 = QuickMatch::new_with(&items4, config4);
27    let results4 = qm4.matches("word:");
28    println!("Colon as sep | query 'word:' vs mixed items:           {results4:?}");
29}
Source

pub fn with_limit(self, limit: usize) -> Self

Source

pub fn with_trigram_budget(self, trigram_budget: usize) -> Self

Source

pub fn with_separators(self, separators: &'static [char]) -> Self

Examples found in repository?
examples/colon_test.rs (line 17)
3fn main() {
4    // Case 1: Items with colon, query with colon (default separators)
5    let items = vec!["word: word2", "other: thing", "word word2"];
6    let qm = QuickMatch::new(&items);
7    let results = qm.matches("word: word2");
8    println!("Default seps | query 'word: word2' vs items with colon: {results:?}");
9
10    // Case 2: Query "word:" against items
11    let items2 = vec!["word: word2", "word word2", "word", "word:"];
12    let qm2 = QuickMatch::new(&items2);
13    let results2 = qm2.matches("word:");
14    println!("Default seps | query 'word:' vs mixed items:           {results2:?}");
15
16    // Case 3: Colon as separator, query "word: word2"
17    let config3 = QuickMatchConfig::new().with_separators(&['_', '-', ' ', ':']);
18    let items3 = vec!["word: word2", "other: thing", "word word2"];
19    let qm3 = QuickMatch::new_with(&items3, config3);
20    let results3 = qm3.matches("word: word2");
21    println!("Colon as sep | query 'word: word2':                    {results3:?}");
22
23    // Case 4: Colon as separator, query "word:"
24    let config4 = QuickMatchConfig::new().with_separators(&['_', '-', ' ', ':']);
25    let items4 = vec!["word: word2", "word word2", "word", "word:"];
26    let qm4 = QuickMatch::new_with(&items4, config4);
27    let results4 = qm4.matches("word:");
28    println!("Colon as sep | query 'word:' vs mixed items:           {results4:?}");
29}
Source

pub fn with_min_score(self, min_score: usize) -> Self

Source

pub fn limit(&self) -> usize

Source

pub fn trigram_budget(&self) -> usize

Source

pub fn separators(&self) -> &[char]

Source

pub fn min_score(&self) -> usize

Trait Implementations§

Source§

impl Default for QuickMatchConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.