File tree 1 file changed +19
-2
lines changed
1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -779,18 +779,35 @@ pub union ManuallyDrop<T>{ value: T }
779
779
780
780
impl < T > ManuallyDrop < T > {
781
781
/// Wrap a value to be manually dropped.
782
+ ///
783
+ /// # Examples
784
+ ///
785
+ /// ```rust
786
+ /// # #![feature(manually_drop)]
787
+ /// use std::mem::ManuallyDrop;
788
+ /// ManuallyDrop::new(Box::new(()));
789
+ /// ```
782
790
#[ unstable( feature = "manually_drop" , issue = "40673" ) ]
783
791
#[ inline]
784
792
pub fn new ( value : T ) -> ManuallyDrop < T > {
785
793
ManuallyDrop { value : value }
786
794
}
787
795
788
796
/// Extract the value from the ManuallyDrop container.
797
+ ///
798
+ /// # Examples
799
+ ///
800
+ /// ```rust
801
+ /// # #![feature(manually_drop)]
802
+ /// use std::mem::ManuallyDrop;
803
+ /// let x = ManuallyDrop::new(Box::new(()));
804
+ /// let _: Box<()> = ManuallyDrop::into_inner(x);
805
+ /// ```
789
806
#[ unstable( feature = "manually_drop" , issue = "40673" ) ]
790
807
#[ inline]
791
- pub fn into_inner ( self ) -> T {
808
+ pub fn into_inner ( slot : ManuallyDrop < T > ) -> T {
792
809
unsafe {
793
- self . value
810
+ slot . value
794
811
}
795
812
}
796
813
You can’t perform that action at this time.
0 commit comments