externally-driven-async-rt 0.3.0

Async runtime that is meant to be embedded
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use core::{cell::UnsafeCell, mem::MaybeUninit, ptr::NonNull};

#[repr(C, align(16))]
#[must_use]
pub(crate) struct Aligned16<const SIZE: usize>(UnsafeCell<MaybeUninit<[u8; SIZE]>>);

impl<const SIZE: usize> Aligned16<SIZE> {
    pub(crate) const fn new() -> Self {
        Self(UnsafeCell::new(MaybeUninit::uninit()))
    }

    pub(crate) fn as_ptr(&self) -> NonNull<u8> {
        NonNull::from(&self.0).cast()
    }
}