bincode-org / bincode

A binary encoder / decoder implementation in Rust.
MIT License
2.63k stars 265 forks source link

Arc/Rc handling clarification #682

Open stefnotch opened 9 months ago

stefnotch commented 9 months ago

I was wondering how bincode currently handles Arc/Rcs. In the case of a DAG (directed acyclic graph), does it duplicate the data, or does it share the data?

I did see https://github.com/bincode-org/bincode/issues/139 , however, I couldn't figure out what the status quo is.

I'd love it if there were a bit of documentation regarding that, similar to what rkyv has.

VictorKoenders commented 9 months ago

Currently bincode simply encodes/decodes the contents of the Arc/Rc: source.

Serde by default does not implement Arc/Rc unless you enable the rc feature: https://serde.rs/feature-flags.html#rc

It would be great if someone could document this.