1use super::*;
2
3// Note(Lokathor): This is the neat part!!
4unsafe impl<T: PodInOption> Pod for Option<T> {}
5
6/// Trait for types which are [Pod](Pod) when wrapped in
7/// [Option](core::option::Option).
8///
9/// ## Safety
10///
11/// * `Option<T>` must uphold the same invariants as [Pod](Pod).
12/// * **Reminder:** pointers are **not** pod! **Do not** mix this trait with a
13/// newtype over [NonNull](core::ptr::NonNull).
14pub unsafe trait PodInOption: ZeroableInOption + Copy + 'static {}
15
16unsafe impl PodInOption for NonZeroI8 {}
17unsafe impl PodInOption for NonZeroI16 {}
18unsafe impl PodInOption for NonZeroI32 {}
19unsafe impl PodInOption for NonZeroI64 {}
20unsafe impl PodInOption for NonZeroI128 {}
21unsafe impl PodInOption for NonZeroIsize {}
22unsafe impl PodInOption for NonZeroU8 {}
23unsafe impl PodInOption for NonZeroU16 {}
24unsafe impl PodInOption for NonZeroU32 {}
25unsafe impl PodInOption for NonZeroU64 {}
26unsafe impl PodInOption for NonZeroU128 {}
27unsafe impl PodInOption for NonZeroUsize {}
28