PacketQueue::init() does not need to be unsafe

This commit is contained in:
Davide Della Giustina 2023-02-28 18:04:43 +00:00
parent 485bb76e46
commit 3c601bf8d2
No known key found for this signature in database

View File

@ -42,10 +42,12 @@ impl<const TX: usize, const RX: usize> PacketQueue<TX, RX> {
} }
// Allow to initialize a Self without requiring it to go on the stack // Allow to initialize a Self without requiring it to go on the stack
pub unsafe fn init(this: &mut MaybeUninit<Self>) { pub fn init(this: &mut MaybeUninit<Self>) {
unsafe {
this.as_mut_ptr().write_bytes(0u8, core::mem::size_of::<Self>()); this.as_mut_ptr().write_bytes(0u8, core::mem::size_of::<Self>());
} }
} }
}
static WAKER: AtomicWaker = AtomicWaker::new(); static WAKER: AtomicWaker = AtomicWaker::new();