/// Given `Self` (`$aligned`), `Self::ULE` (`$unaligned`), and a conversion function (`$single` or /// `Self::from_aligned`), implement `from_array` for arrays of `$aligned` to `$unaligned`. /// /// The `$default` argument is due to current compiler limitations. /// Pass any (cheap to construct) value. #[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), "`.")] pubconstfn from_array<const N: usize>(arr: [$aligned; N]) -> [Self; N] { letmut result = [$default; N]; letmut i = 0; // Won't panic because i < N and arr has length N #[allow(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);
};
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet am 2026-06-19)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.