Crates.io | trie_of_lists |
lib.rs | trie_of_lists |
version | |
source | src |
created_at | 2025-02-01 06:05:32.732065 |
updated_at | 2025-02-02 17:26:36.830344 |
description | Trie library for storing and searching lists of arbitrary data structures efficiently that have substantial overlap. For example file paths |
homepage | |
repository | |
max_upload_size | |
id | 1538219 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Trie focusing on sections of arbitrary data structures instead of raw strings Personal usecase was quickly searching for valid paths
Published on crates.io
let mut trie: Trie<String, bool> = Trie::new();
let path_1 = Path::new("/etc/bin/echos");
let nonexistant_path = Path::new("/etc/bin/echo");
trie.insert(path_to_iter(path_1), true);
assert!(trie.contains(path_to_iter(path_1)));
assert!(!trie.contains(path_to_iter(nonexistant_path)));
let path_2 = Path::new("/etc/bin/echo/env");
trie.insert(path_to_iter(path_2), true);
let target_path = Path::new("/etc/bin/echo/env/frogs");
assert_eq!(trie.best_match(path_to_iter(target_path)), Some(path_2.clone()));
See lib.rs
tests for more examples.