Closed QnnOkabayashi closed 9 months ago
I agree it is certainly possible to add these methods, but I'm not sure that the pros outweigh the cons here.
That said, I don't think there is any technical reason one couldn't build this on top of bumpalo
in an external crate. I'd suggest investigating this route further.
Thanks!
In my project, I've been using the
Bump::alloc_slice_*
family of methods a lot. Since the returned slices are freshly allocated, why not allow for aThinSlice
type that's just a single pointer into theBump
buffer that points to the length followed by that many elements? It would laid out a lot likeThinVec
, but the data is owned by theBump
and with immutable length. You could then have itDeref
/DerefMut
to a regular slice as well, granting it all the methods and flexibility that slices come with.For naming, we could just give each
alloc_slice_*
method a correspondingalloc_thin_slice_*
method.Pros
Cons
I'm happy to discuss or send in a PR for this if it sounds good to you.