3 releases

Uses old Rust 2015

0.1.4 Oct 28, 2017
0.1.3 Sep 12, 2017
0.1.0 Sep 4, 2017

#25 in #datastructure


205 lines

fs-trie Crates.io Crates.io

A naive trie with serde/bincode helpers to load and store to a file.


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"));
    "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);


~37K SLoC