artiq/artiq/firmware/libproto
whitequark 88bf7d2233 firmware: specialize protocol read/write functions.
Before this commit, proto::io::{read,write}_* functions were taking
a &mut {Read,Write}. This means a lot of virtual dispatch.
After this commit, all these functions are specialized for
the specific IO trait.

This could be achieved with just changing the signature from
  fn read_x(reader: &mut Read)
to
  fn read_x<R: Read>(reader: &mut R)
but the functions were also grouped into ReadExt and WriteExt
traits as a refactoring.

Initially, it was expected that the generic traits from
the byteorder crate could be used, but they require endianness
to be specified on every call and thus aren't very ergonomic.
They also lack the equivalent to our read_string and read_bytes.

Thus, it seems fine to just define a slightly different extension
trait.

This also optimized the test_rpc_timing test: 1.7ms→1.2ms.
2017-02-26 18:24:37 +00:00
..
analyzer_proto.rs firmware: specialize protocol read/write functions. 2017-02-26 18:24:37 +00:00
Cargo.toml firmware: restructure to avoid #[path = "..."] mod ...; 2017-02-25 17:54:14 +00:00
kernel_proto.rs Implement recording of DMA traces on the core device. 2017-02-26 02:50:20 +00:00
lib.rs firmware: specialize protocol read/write functions. 2017-02-26 18:24:37 +00:00
moninj_proto.rs firmware: specialize protocol read/write functions. 2017-02-26 18:24:37 +00:00
rpc_proto.rs firmware: specialize protocol read/write functions. 2017-02-26 18:24:37 +00:00
session_proto.rs firmware: specialize protocol read/write functions. 2017-02-26 18:24:37 +00:00