From 5bdf0774752c4d6ca4746facbb47f42fcfbb3076 Mon Sep 17 00:00:00 2001 From: Intege-rs Date: Sat, 16 Nov 2024 20:38:23 -0500 Subject: [PATCH] add Mut<>::uninit --- sub/core/src/pod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sub/core/src/pod.rs b/sub/core/src/pod.rs index 9e3be71..991f4a7 100644 --- a/sub/core/src/pod.rs +++ b/sub/core/src/pod.rs @@ -43,6 +43,10 @@ impl Mut { pub fn set(&self, value: T) { unsafe { core::ptr::write(self.as_ptr(), value) } } pub fn get(&self) -> T { unsafe { core::ptr::read(self.as_ptr()) } } } +impl Mut> { + pub const fn zeroed() -> Self { Self(core::cell::UnsafeCell::new(MaybeUninit::zeroed())) } + pub const fn uninit() -> Self { Self(core::cell::UnsafeCell::new(MaybeUninit::uninit())) } +} impl Deref for Mut { type Target = core::cell::UnsafeCell;