From d691aa6a1435cb773cc2a27bbf9bc374806fb19d Mon Sep 17 00:00:00 2001 From: John Date: Mon, 6 Jun 2022 12:20:34 -0700 Subject: [PATCH] implement NoUninit for NonZero* (#107) --- src/no_uninit.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/no_uninit.rs b/src/no_uninit.rs index ae628cb..620886d 100644 --- a/src/no_uninit.rs +++ b/src/no_uninit.rs @@ -1,4 +1,18 @@ use crate::Pod; +use core::num::{ + NonZeroU8, + NonZeroI8, + NonZeroU16, + NonZeroI16, + NonZeroU32, + NonZeroI32, + NonZeroU64, + NonZeroI64, + NonZeroU128, + NonZeroI128, + NonZeroUsize, + NonZeroIsize, +}; /// Marker trait for "plain old data" types with no uninit (or padding) bytes. /// @@ -57,3 +71,16 @@ unsafe impl NoUninit for T {} unsafe impl NoUninit for char {} unsafe impl NoUninit for bool {} + +unsafe impl NoUninit for NonZeroU8 {} +unsafe impl NoUninit for NonZeroI8 {} +unsafe impl NoUninit for NonZeroU16 {} +unsafe impl NoUninit for NonZeroI16 {} +unsafe impl NoUninit for NonZeroU32 {} +unsafe impl NoUninit for NonZeroI32 {} +unsafe impl NoUninit for NonZeroU64 {} +unsafe impl NoUninit for NonZeroI64 {} +unsafe impl NoUninit for NonZeroU128 {} +unsafe impl NoUninit for NonZeroI128 {} +unsafe impl NoUninit for NonZeroUsize {} +unsafe impl NoUninit for NonZeroIsize {} \ No newline at end of file