bytes
bytes copied to clipboard
Consider adding `BytesRef`
This would be the Bytes
equivalent of WakerRef
.
If we do that, then we could switch Bytes::slice_ref
-> BytesRef::new(&my_bytes, my_slice)
... possibly even adding BytesRef::new_unchecked
.
Follow up to #298.
What does this add over let slice = &bytes[a..b]
?
It lets you slice further into owned handles.
When you clone a WakerRef
you get a Waker
. Which in Waker
s cases typically is just a refcount bump, since the Waker
has already been allocated.
What would clone
ing a BytesRef
do? If it gives us Bytes
, then the clone
in the vtable needs to be implemented as a heap allocation. If it gives us another BytesRef
(in order to just slice the ref), then the required vtable function is different.