#autocomplete #search #trie #word

search-autocompletion

A Rust implementation of Search Auto Completion

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

#1650 in Algorithms

Download history 3/week @ 2024-02-25 54/week @ 2024-03-31

54 downloads per month

GPL-3.0 license

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"]);

No runtime deps