Open Sytten opened 5 months ago
The Vec::splice
method is complicated because it has to work with types that are not Copy
. However, u8
is Copy
, so it should not be too hard to emulate it with copy_within
followed by truncate
.
The hard part really is when the destination range is smaller than the source range since it requires at least one reallocation (if the size hint lower bound proves to be enough).
In my question to move from
Arc<Vec<u8>>
toBytesMut
, I am facing a couple of missing methods I had onVec
. One of them issplice
(https://doc.rust-lang.org/std/vec/struct.Vec.html#method.splice). I am guessing this method could go inBufMut
?