What is Fuse?
Fuse is a super lightweight library which provides a simple way to do fuzzy searching.
Fuse-RS is a port of https://github.com/krisk/fuse-swift written purely in rust.
Usage
An example of a real use case, a search bar made using iced is also available.
Try it using
cargo run --package search_bar
Check all available examples and their source code here.
Async
Use the feature flag "async" to also be able to use async functions.
= { = ..., features = ["async"]}
Initializing
The first step is to create a fuse object, with the necessary parameters. Fuse::default, returns the following parameters.
default = Fuse
For how to implement individual searching operations, check the examples.
Options
As given above, Fuse takes the following options
location: Approximately where in the text is the pattern expected to be found. Defaults to0distance: Determines how close the match must be to the fuzzylocation(specified above). An exact letter match which isdistancecharacters away from the fuzzy location would score as a complete mismatch. A distance of0requires the match be at the exactlocationspecified, adistanceof1000would require a perfect match to be within800characters of the fuzzy location to be found using a 0.8 threshold. Defaults to100threshold: At what point does the match algorithm give up. A threshold of0.0requires a perfect match (of both letters and location), a threshold of1.0would match anything. Defaults to0.6maxPatternLength: The maximum valid pattern length. The longer the pattern, the more intensive the search operation will be. If the pattern exceeds themaxPatternLength, thesearchoperation will returnnil. Why is this important? Read this. Defaults to32isCaseSensitive: Indicates whether comparisons should be case sensitive. Defaults tofalse