Crates.io | suffix_trie |
lib.rs | suffix_trie |
version | 0.1.0 |
source | src |
created_at | 2024-03-29 11:56:28.140766 |
updated_at | 2024-03-29 11:56:28.140766 |
description | Suffix trie for searching |
homepage | |
repository | https://github.com/EgorGorshen/suffix-tier |
max_upload_size | |
id | 1189905 |
size | 10,634 |
This Rust library provides a flexible and efficient implementation of a Suffix Trie data structure, ideal for applications involving string searches, autocomplete systems, and other text processing tasks. It supports adding words, searching by prefix, and collecting all suffixes or substrings that match a given prefix.
Add this to your Cargo.toml
:
[dependencies]
suffix_trie = "0.1.0"
Here's a quick example to get you started:
use suffix_trie::SuffixTrie;
let mut trie = SuffixTrie::new();
trie.add_suffix("hello".to_string());
trie.add_suffix("helium".to_string());
if let Some(suffixes) = trie.find_prefixes("he") {
for suffix in suffixes {
println!("{}", suffix);
}
}
To run tests, use the following command:
cargo test
Contributions are welcome! Please feel free to submit pull requests, create issues, or suggest improvements.