Skip to content

Commit

Permalink
Rollup merge of rust-lang#35436 - frewsxcv:into-vec, r=GuillaumeGomez
Browse files Browse the repository at this point in the history
Add doc example for `std::ffi::NulError::into_vec`.

None
  • Loading branch information
Jonathan Turner committed Aug 7, 2016
2 parents c150ce6 + 0a6b862 commit d9e6bbd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/libstd/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,15 @@ impl NulError {

/// Consumes this error, returning the underlying vector of bytes which
/// generated the error in the first place.
///
/// # Examples
///
/// ```
/// use std::ffi::CString;
///
/// let nul_error = CString::new("foo\0bar").unwrap_err();
/// assert_eq!(nul_error.into_vec(), b"foo\0bar");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn into_vec(self) -> Vec<u8> { self.1 }
}
Expand Down

0 comments on commit d9e6bbd

Please sign in to comment.