Closed lschmierer closed 6 years ago
Currently, on no_std hardware, we always allocate the maximum possible packet size on the heap. This is not very efficient.
no_std
Handle nested PDUs as simple &[u8] slices.
&[u8]
trait Pdu { fn vector(&self) -> u32; fn pack(&self, buf: &[u8]) -> Result<(), PackError> { ... } fn pack_header(&self, buf: &[u8]) -> Result<(), PackError>; fn pack_data(&self, buf: &[u8]) -> Result<(), PackError>; fn len(&self) -> usize { ... } fn vector_len(&self) -> usize; fn header_len(&self) -> usize; fn data_len(&self) -> usize; }
This makes all very complicated and the API inerergonomic. Also, a packet size of 1144 bytes (about 1 kB) does not seem too bad.
Currently, on
no_std
hardware, we always allocate the maximum possible packet size on the heap. This is not very efficient.Handle nested PDUs as simple
&[u8]
slices.