Re: [PATCH 5/6] gpu: nova-core: add NVKV typed decoding

"Danilo Krummrich" <[email protected]>
Newsgroups org.kernel.vger.rust-for-linux,dev.linux.lists.nova-gpu,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.