Skip to content

Commit d6d98b7

Browse files
authored
Feat: Implement DeviceCopy for MaybeUninit (#43)
1 parent 99ace7a commit d6d98b7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

crates/cust_core/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pub use cust_derive::DeviceCopyCore as DeviceCopy;
66
#[doc(hidden)]
77
pub mod _hidden {
88
use core::marker::PhantomData;
9+
use core::mem::MaybeUninit;
910
use core::num::*;
1011

1112
/// Marker trait for types which can safely be copied to or from a CUDA device.
@@ -87,6 +88,7 @@ pub mod _hidden {
8788

8889
NonZeroU8 NonZeroU16 NonZeroU32 NonZeroU64 NonZeroU128
8990
);
91+
unsafe impl<T: DeviceCopy> DeviceCopy for MaybeUninit<T> {}
9092
unsafe impl<T: DeviceCopy> DeviceCopy for Option<T> {}
9193
unsafe impl<L: DeviceCopy, R: DeviceCopy> DeviceCopy for Result<L, R> {}
9294
unsafe impl<T: ?Sized + DeviceCopy> DeviceCopy for PhantomData<T> {}

0 commit comments

Comments
 (0)