Crate fs_trie [−] [src]
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:
⚠Be careful when using this code, it's not being tested!
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 |
Type Definitions
BincodeError |
An error that can be produced during (de)serializing. |