3 releases
Uses old Rust 2015
0.1.4 | Oct 28, 2017 |
---|---|
0.1.3 | Sep 12, 2017 |
0.1.0 | Sep 4, 2017 |
#18 in #datastructure
21 downloads per month
11KB
205 lines
fs-trie
A naive trie with serde/bincode helpers to load and store to a file.
lib.rs
:
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);
Dependencies
~1–1.6MB
~36K SLoC