#[macro_export]
macro_rules! impl_ule_from_array {
($aligned:ty, $unaligned:ty, $default:expr, $single:path) => {
#[doc = concat!("Convert an array of `", stringify!($aligned), "` to an array of `", stringify!($unaligned), "`.")]
pub const fn from_array<const N: usize>(arr: [$aligned; N]) -> [Self; N] {
let mut result = [$default; N];
let mut i = 0;
#[expect(clippy::indexing_slicing)]
while i < N {
result[i] = $single(arr[i]);
i += 1;
}
result
}
};
($aligned:ty, $unaligned:ty, $default:expr) => {
impl_ule_from_array!($aligned, $unaligned, $default, Self::from_aligned);
};
}