make set return a mutable reference
This commit is contained in:
parent
760424af17
commit
f8c7d8dc8e
@ -1117,11 +1117,14 @@ pub fn zeroed() -> MaybeUninit<T> {
|
||||
}
|
||||
|
||||
/// Set the value of the `MaybeUninit`. This overwrites any previous value without dropping it.
|
||||
/// For your convenience, this also returns a mutable reference to the (now
|
||||
/// safely initialized) content of `self`.
|
||||
#[unstable(feature = "maybe_uninit", issue = "53491")]
|
||||
#[inline(always)]
|
||||
pub fn set(&mut self, val: T) {
|
||||
pub fn set(&mut self, val: T) -> &mut T {
|
||||
unsafe {
|
||||
self.value = ManuallyDrop::new(val);
|
||||
self.get_mut()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user