I'm pretty excited about the improvements that ReadBuf
can bring, but I'm also still wondering if can slightly generalize is to close another safety gap.
My observation is that Vec<T>
is analogous to a ReadBuf
in that it consists of a filled part (len
) and an uninitialized part (capacity
). However, if we wrap the Vec
's backing byte array in a ReadBuf
, we will still need to unsafely set the len for Vec
. Would it be worth it to give the ReadBuf
type some kind of type parameter that will allow it to update the backing store when the ReadBuf
itself is dropped?
Or, going even further, should we extend ReadBuf
to support types of data other than u8
, especially as we see the work on safe transmutes come to fruition?