trie_of_lists

Crates.iotrie_of_lists
lib.rstrie_of_lists
version0.3.0
created_at2025-02-01 06:05:32.732065+00
updated_at2025-02-02 17:26:36.830344+00
descriptionTrie library for storing and searching lists of arbitrary data structures efficiently that have substantial overlap. For example file paths
homepage
repository
max_upload_size
id1538219
size6,527
Archer (ArcherHeffern)

documentation

README

Description

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.

Commit count: 0

cargo fmt