6 releases (3 breaking)
0.4.0 | Apr 28, 2021 |
---|---|
0.3.0 | Feb 10, 2021 |
0.2.0 | Feb 10, 2021 |
0.1.2 | Feb 10, 2021 |
#2593 in Algorithms
7KB
88 lines
Search AutoCompletion
A Rust implementation of Search Auto Completion.
Usage
Create a new AutoComplete struct, you can use default(Empty) or new(Must be used with pre-defined words).
License
The license is GNU General Public License v3.0
lib.rs
:
A Rust implementation of Search Auto Completion
Examples
use search_autocompletion::AutoComplete;
let mut com = AutoComplete::default();
com.insert(&("Hello", 9));
com.insert(&("Hell", 10));
com.insert(&("Ham", 1000));
com.insert(&("Hen", 54));
let strings = com.get_strings_for_prefix("He").unwrap();
assert_eq!(strings, vec!["Hen", "Hell", "Hello"]);