File tree 1 file changed +16
-2
lines changed
1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,14 @@ impl<T> MaybeUninit<T> {
246
246
/// Note that dropping a `MaybeUninit<T>` will never call `T`'s drop code.
247
247
/// It is your responsibility to make sure `T` gets dropped if it got initialized.
248
248
///
249
+ /// # Example
250
+ ///
251
+ /// ```
252
+ /// use std::mem::MaybeUninit;
253
+ ///
254
+ /// let v: MaybeUninit<Vec<u8>> = MaybeUninit::new(vec![42]);
255
+ /// ```
256
+ ///
249
257
/// [`assume_init`]: MaybeUninit::assume_init
250
258
#[ stable( feature = "maybe_uninit" , since = "1.36.0" ) ]
251
259
#[ rustc_const_stable( feature = "const_maybe_uninit" , since = "1.36.0" ) ]
@@ -259,9 +267,15 @@ impl<T> MaybeUninit<T> {
259
267
/// Note that dropping a `MaybeUninit<T>` will never call `T`'s drop code.
260
268
/// It is your responsibility to make sure `T` gets dropped if it got initialized.
261
269
///
262
- /// See the [type-level documentation][type ] for some examples.
270
+ /// See the [type-level documentation][MaybeUninit ] for some examples.
263
271
///
264
- /// [type]: union.MaybeUninit.html
272
+ /// # Example
273
+ ///
274
+ /// ```
275
+ /// use std::mem::MaybeUninit;
276
+ ///
277
+ /// let v: MaybeUninit<String> = MaybeUninit::uninit();
278
+ /// ```
265
279
#[ stable( feature = "maybe_uninit" , since = "1.36.0" ) ]
266
280
#[ rustc_const_stable( feature = "const_maybe_uninit" , since = "1.36.0" ) ]
267
281
#[ inline( always) ]
You can’t perform that action at this time.
0 commit comments