Consider tor_bytes::write/read_counted_u8 etc
We frequently want to encode a number of objects as a u8 or u16, and then encode the objects one by one. We could benefit from a helper method in Reader and/or Writer to do that.
One possible API:
impl Reader {...
pub fn read_counted_u8<V:Readable>(&mut self) -> Result<Vec<V>> { ... }
}
trait Writer {
pub fn write_counted_u8<V:Writeable>(&mut self, slice: &[V]) -> EncodeResult<()> {...}
}
This comes out of a discussion on !1052 (merged)