Expand description
§A trie that can be saved to and loaded from a file
This crate implements a Trie with char keys. The trie can be saved to and loaded from a file on the local filesystem. This allows the user to persist the trie between executions.
Basic example:
ⓘ
let trie_file = "/path/to/trie-file";
let mut trie = fs_trie::Trie::default();
trie.insert("abc", String::from("contents1"));
trie.insert("abd", String::from("contents2"));
trie.insert("hello", String::from("world"));
trie.save_to_file(trie_file).expect(
"Couldn't save trie to file",
);
let trie2 = fs_trie::Trie::load_from_file(trie_file).expect("Couldn't load trie from file");
assert_eq!(trie, trie2);Structs§
- Trie
- The Trie struct. The children are a
std::collections::HashMapof other Tries.
Type Aliases§
- Bincode
Error - An error that can be produced during (de)serializing.