We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 760424a commit f8c7d8dCopy full SHA for f8c7d8d
src/libcore/mem.rs
@@ -1117,11 +1117,14 @@ impl<T> MaybeUninit<T> {
1117
}
1118
1119
/// Set the value of the `MaybeUninit`. This overwrites any previous value without dropping it.
1120
+ /// For your convenience, this also returns a mutable reference to the (now
1121
+ /// safely initialized) content of `self`.
1122
#[unstable(feature = "maybe_uninit", issue = "53491")]
1123
#[inline(always)]
- pub fn set(&mut self, val: T) {
1124
+ pub fn set(&mut self, val: T) -> &mut T {
1125
unsafe {
1126
self.value = ManuallyDrop::new(val);
1127
+ self.get_mut()
1128
1129
1130
0 commit comments