easy-trie

Crates.ioeasy-trie
lib.rseasy-trie
version0.1.4
created_at2025-02-24 13:44:30.809311+00
updated_at2025-02-25 11:02:01.60446+00
descriptionA simple trie implementation in Rust
homepage
repositoryhttps://github.com/macmist/rust-trie
max_upload_size
id1567478
size22,418
Macmist (macmist)

documentation

README

Simple Trie

Github Action Crate License

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()));
Commit count: 22

cargo fmt