jonas-schievink / rubble

(going to be a) BLE stack for embedded Rust
BSD Zero Clause License
397 stars 56 forks source link

Try out `scroll` or `zerocopy` for de/encoding of PDUs #53

Open jonas-schievink opened 5 years ago

jonas-schievink commented 5 years ago

scroll allows deriving decoding and encoding traits, which is just what I want. We should try porting rubble to use that instead of bytes.rs.

We can also try out the zerocopy crate, which allows C-like reinterpretation of arbitrary bytes in safe Rust. Unfortunately it's near impossible to contribute to zerocopy since it's part of fuchsia, but it looks promising.

jonas-schievink commented 4 years ago

It'd be pretty easy to add a method to ByteReader that reads any type implementing zerocopy::FromBytes. Then we can gradually move hand-written deserialization code to make use of that.