Could you borrow a bit?
Rust Internals [Unofficial]
May 18, 2026
It's just a rough draft. Sure, you can keep the byte length as usize and pack head and tail bit offsets into u8 or use some other layout, it does not change the idea.
You are unlikely to encounter in practice allocations larger than usize::MAX / 4 bits, especially considering that allocations in Rust can not be bigger than isize::MAX bytes, so we can just panic in such pathological scenarios.
mathstuf:
the
PhantomDataneeds to keep a reference to a[u8]slice
AFAIK there is absolutely no difference between PhantomData<&'a mut u8> and PhantomData<&'a mut [u8]>. PhantomData is used to track the lifetime and variance, so the concrete type does not matter here.
Discussion in the ATmosphere