add Mut<>::uninit
This commit is contained in:
@@ -43,6 +43,10 @@ impl<T: Pod> Mut<T> {
|
|||||||
pub fn set(&self, value: T) { unsafe { core::ptr::write(self.as_ptr(), value) } }
|
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()) } }
|
pub fn get(&self) -> T { unsafe { core::ptr::read(self.as_ptr()) } }
|
||||||
}
|
}
|
||||||
|
impl<T> Mut<MaybeUninit<T>> {
|
||||||
|
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<T> Deref for Mut<T> {
|
impl<T> Deref for Mut<T> {
|
||||||
type Target = core::cell::UnsafeCell<T>;
|
type Target = core::cell::UnsafeCell<T>;
|
||||||
|
|||||||
Reference in New Issue
Block a user