Re: [PATCH 1/7] rust: dma: add from-slice constructors for Coherent and CoherentBox
From: Danilo Krummrich
Date: Thu Mar 26 2026 - 11:10:43 EST
On 3/26/26 3:59 PM, Alexandre Courbot wrote:
> Then it looks like this:
>
> let mut slice = Self(Coherent::<T>::alloc_slice_with_attrs(
> dev,
> data.len(),
> gfp_flags,
> dma_attrs,
> )?);
>
> // PANIC: `slice` was created with length `data.len()`.
> slice.copy_from_slice(data);
>
> Ok(slice)
>
> FWIW I find using `map` more elegant, but I've made the change for v2
> nonetheless.
I also prefer map() in this case.