Open
Description
#5378 is adding VarZeroLengthlessSlice
. However, it cannot be used inside VarZeroSlice
because VarZeroSlice
has an optimization where empty slices are represented as the empty array, so we cannot do
struct VarZeroSlice<T, F> {
length: RawBytesULE<4>,
indices_and_data: VarZeroLengthlessSlice<T, F>,
}
However, @sffc had an idea. We could write a very simple abstraction that wraps [u8]
which produces an Option<&NonemptyVarZeroSlice>
, and NonemptyVarZeroSlice
is represented as above. This is a simple optimization.
I'm not considering this a part of #5378 but I think it should be on the cards for the future! It's purely internal.