mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-29 15:04:32 +01:00
Added get_mut and get_ref into the nightly as well
This commit is contained in:
parent
7de26409c2
commit
2e3a889991
1 changed files with 5 additions and 7 deletions
|
@ -82,21 +82,19 @@ impl<T> MaybeUninit<T> {
|
||||||
self.inner.as_mut_ptr()
|
self.inner.as_mut_ptr()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
pub fn write(&mut self, value: T) -> &mut T {
|
|
||||||
self.inner.write(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(feature = "nightly"))]
|
|
||||||
pub unsafe fn get_ref(&self) -> &T {
|
pub unsafe fn get_ref(&self) -> &T {
|
||||||
&*self.inner.as_ptr()
|
&*self.inner.as_ptr()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "nightly"))]
|
|
||||||
pub unsafe fn get_mut(&mut self) -> &mut T {
|
pub unsafe fn get_mut(&mut self) -> &mut T {
|
||||||
&mut *self.inner.as_mut_ptr()
|
&mut *self.inner.as_mut_ptr()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "nightly")]
|
||||||
|
pub fn write(&mut self, value: T) -> &mut T {
|
||||||
|
self.inner.write(value)
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "nightly"))]
|
#[cfg(not(feature = "nightly"))]
|
||||||
pub fn write(&mut self, value: T) -> &mut T {
|
pub fn write(&mut self, value: T) -> &mut T {
|
||||||
self.inner = core::mem::MaybeUninit::new(value);
|
self.inner = core::mem::MaybeUninit::new(value);
|
||||||
|
|
Loading…
Reference in a new issue