5 releases
0.1.4 | Feb 25, 2025 |
---|---|
0.1.3 | Feb 24, 2025 |
0.1.2 | Feb 24, 2025 |
0.1.1 | Feb 24, 2025 |
0.1.0 | Feb 24, 2025 |
#6 in #hello
379 downloads per month
11KB
191 lines
Simple Trie
This is a simple rust trie library. Essentially, I wanted to understand how to create and publish a crate so I was looking for something simple but useful.
Installation
cargo add easy-trie
Examples
Simple case
use easy_trie::trie::Trie;
let mut trie = Trie::new();
trie.insert("hello");
assert_eq!(trie.len(), 5);
assert!(trie.contains("hello"));
assert!(!trie.contains("world"));
Suggestions
use easy_trie::trie::Trie;
let mut trie = Trie::new();
trie.insert("hello");
trie.insert("help");
let suggestions = trie.suggest("h");
assert!(suggestions.contains(&"hello".to_string()));
assert!(suggestions.contains(&"help".to_string()));