@@ -1340,6 +1340,25 @@ impl<'a> IoSliceMut<'a> {
13401340            bufs[ 0 ] . advance ( left) ; 
13411341        } 
13421342    } 
1343+ 
1344+     /// Get the underlying bytes as a mutable slice with the original lifetime. 
1345+      /// 
1346+      /// # Examples 
1347+      /// 
1348+      /// ``` 
1349+      /// #![feature(io_slice_as_bytes)] 
1350+      /// use std::io::IoSliceMut; 
1351+      /// 
1352+      /// let mut data = *b"abcdef"; 
1353+      /// let io_slice = IoSliceMut::new(&mut data); 
1354+      /// io_slice.into_slice()[0] = b'A'; 
1355+      /// 
1356+      /// assert_eq!(&data, b"Abcdef"); 
1357+      /// ``` 
1358+      #[ unstable( feature = "io_slice_as_bytes" ,  issue = "132818" ) ]  
1359+     pub  const  fn  into_slice ( self )  -> & ' a  mut  [ u8 ]  { 
1360+         self . 0 . into_slice ( ) 
1361+     } 
13431362} 
13441363
13451364#[ stable( feature = "iovec" ,  since = "1.36.0" ) ]  
@@ -1482,6 +1501,32 @@ impl<'a> IoSlice<'a> {
14821501            bufs[ 0 ] . advance ( left) ; 
14831502        } 
14841503    } 
1504+ 
1505+     /// Get the underlying bytes as a slice with the original lifetime. 
1506+      /// 
1507+      /// This doesn't borrow from `self`, so is less restrictive than calling 
1508+      /// `.deref()`, which does. 
1509+      /// 
1510+      /// # Examples 
1511+      /// 
1512+      /// ``` 
1513+      /// #![feature(io_slice_as_bytes)] 
1514+      /// use std::io::IoSlice; 
1515+      /// 
1516+      /// let data = b"abcdef"; 
1517+      /// 
1518+      /// let mut io_slice = IoSlice::new(data); 
1519+      /// let tail = &io_slice.as_slice()[3..]; 
1520+      /// 
1521+      /// // This works because `tail` doesn't borrow `io_slice` 
1522+      /// io_slice = IoSlice::new(tail); 
1523+      /// 
1524+      /// assert_eq!(io_slice.as_slice(), b"def"); 
1525+      /// ``` 
1526+      #[ unstable( feature = "io_slice_as_bytes" ,  issue = "132818" ) ]  
1527+     pub  const  fn  as_slice ( self )  -> & ' a  [ u8 ]  { 
1528+         self . 0 . as_slice ( ) 
1529+     } 
14851530} 
14861531
14871532#[ stable( feature = "iovec" ,  since = "1.36.0" ) ]  
0 commit comments