On Thu Aug 20, 2026 at 3:59 AM JST, Danilo Krummrich wrote:
> On Mon Aug 17, 2026 at 2:56 PM CEST, Eliot Courtney wrote:
>> +/// A fixed capacity vector that holds at most `N` elements.
>> +#[derive(Debug, Copy, Clone, PartialEq, Eq, Zeroable)]
>> +pub(crate) struct ArrayVec<T, const N: usize> {
>> +    data: [T; N],
>
> This should be [MaybeUninit<T>; N].
>
>> +    len: usize,
>> +}
>
> Let's move this into the alloc module.
>
>> +impl<T: Default + Copy, const N: usize> Default for ArrayVec<T, N> {
>> +    fn default() -> Self {
>> +        Self {
>> +            data: [T::default(); N],
>> +            len: 0,
>> +        }
>> +    }
>> +}
>
> For anything that actually constructs an ArrayVec we should probably consider 
> to
> restrict its size with a const_assert!()?
>
> For an initializer approach that'd be not an issue of course.
>
>       fn init_with<E>(f: impl FnOnce(&mut Self) -> Result<(), E>) -> impl 
> Init<Self, E>

Thanks, that all sounds good to me.

If we move it to the alloc module, I'm thinking to add a few methods
that I think might be useful (e.g. push). But lmk if we should keep it
to the bare minimum - just feels a bit odd to add something to common
infra that you e.g. couldn't even call push() on.

Reply via email to