Closed rkimoakbioinformatics closed 3 years ago
Thanks for opening an issue! I'll try to look into this in the next few days.
What I am thinking right now is to add Serialize / Deserialize to Interval
and Lapper
and put that behind a feature flag in cargo. I'm not sure how that will interact with num-traits
though.
To clarify, are you trying to use serde
to include these structs in some larger format, or just persist them to disk?
See the linked Draft PR for my first pass.
cargo run --example serde
will print things out (not that that example data is not great, it's purely for showing that the lapper round trips nicely).
I need to add tests and feature gate serde / bincode before this can be released, but this is a start / template for how I would do it.
Thanks. Regarding your question, my structs had the following:
pub struct Rgs { pub ivs: Vec<Interval<u32, u32>>, pub lapper: Option<Lapper<u32, u32>>, }
I'm trying to save this as a file and then reconstruct it from the file.
I tried the feature/serde branch and the code compiled.
Thanks again.
No problem! I just pushed a v1.0.0 release that has the serde features gated by with_serde
. LMK if you run into any issues.
Hi, thanks for the crate. I made some structs with Interval and Lapper in them. I'd like to serialize and deserialize the structs, but am stuck in serializing and deserializing Interval and Lapper. Any advice on this would be appreciated.