I’m interested in building an abstraction that represents a non-contiguous buffer of u8 bytes (my own implementation of the bytes’ crate Buf
trait, abstracting over multiple Bytes
objects).
So for example:
struct MyBuffer {
buffers: Vec<Vec<u8>>
}
impl MyBuffer {
pub fn slice(&self, start: usize, end: usize) -> &[u8] {
//....
}
In this case a slice might overlap two inner vectors. Is it possible for me to abstract this away as one contiguous slice?