dhardy / pippin

a distributed-merge capable database for many small objects
ISC License
78 stars 4 forks source link

Element serialisation #25

Open dhardy opened 8 years ago

dhardy commented 8 years ago

Currently read and write operations in traits require an extra level of buffering. Alternative methods for direct reading/writing could be required, but this has some caveats: the writer must know in advance exactly how much data will be written and must read exactly the amount of data given, failing if data cannot be read.

A compromise would be to allow the user to choose which to implement. But this would require a switch describing which methods should be used, which is where associated constants come in (Rust issue #29646).

Traits this is applicable to:

Element in element.rs
dhardy commented 7 years ago

Alternative: use Serde for element (de)serialisation.

Element trait would then be a bunch of super-trait requirements plus a sum default/optimised function.