laysakura / trie-rs

Memory efficient trie (prefix tree) library based on LOUDS
https://crates.io/crates/trie-rs
Apache License 2.0
90 stars 10 forks source link

Serialization/deserialization not working properly #33

Open crabdancing opened 3 months ago

crabdancing commented 3 months ago

Steps to reproduce:

1) Downloads words.txt 2)


fn main() {
    let mut t = TrieBuilder::new();
    for word in std::fs::read_to_string("words.txt")
        .unwrap()
        .split_whitespace()
    {
        if !word.trim().is_empty() {
            t.push(word);
        }
    }
    let t = t.build();
    println!("Loaded");
    let mut f = File::create_new("words.toml").unwrap();
    write!(f, "{}", toml::to_string(&t).unwrap()).unwrap();
}

3)

Loaded
thread 'main' panicked at src/main.rs:57:41:
called `Result::unwrap()` on an `Err` value: Error { inner: UnsupportedType(Some("unit")) }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Other libraries like postcard also fail, but with deserialization failing instead.

shanecelis commented 3 months ago

Thank you for reporting this.

crabdancing commented 3 months ago

No worries :)