Remove lifetime from DMA transfer handle

This commit is contained in:
Gwilym Inzani 2024-05-27 13:20:13 +01:00
parent 97d474e989
commit 248f71dbfa

View file

@ -77,11 +77,11 @@ impl Dma {
/// # Examples /// # Examples
/// ///
/// See the `dma_effect_*` examples in the repository to see some ways to use this. /// See the `dma_effect_*` examples in the repository to see some ways to use this.
pub unsafe fn hblank_transfer<'a, T>( pub unsafe fn hblank_transfer<T>(
&'a self, &self,
location: &DmaControllable<T>, location: &DmaControllable<T>,
values: &'a [T], values: &[T],
) -> DmaTransferHandle<'a, T> ) -> DmaTransferHandle<T>
where where
T: Copy, T: Copy,
{ {
@ -127,17 +127,15 @@ impl<Item> DmaControllable<Item> {
} }
} }
pub struct DmaTransferHandle<'a, T> pub struct DmaTransferHandle<T>
where where
T: Copy, T: Copy,
{ {
number: usize, number: usize,
data: Pin<Box<[T]>>, data: Pin<Box<[T]>>,
phantom: PhantomData<&'a ()>,
} }
impl<'a, T> DmaTransferHandle<'a, T> impl<T> DmaTransferHandle<T>
where where
T: Copy, T: Copy,
{ {
@ -145,12 +143,11 @@ where
Self { Self {
number, number,
data: Box::into_pin(data.into()), data: Box::into_pin(data.into()),
phantom: PhantomData,
} }
} }
} }
impl<'a, T> Drop for DmaTransferHandle<'a, T> impl<T> Drop for DmaTransferHandle<T>
where where
T: Copy, T: Copy,
{ {