about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorJonathan Turner <jonathandturner@users.noreply.github.com>2016-08-07 09:59:44 -0700
committerGitHub <noreply@github.com>2016-08-07 09:59:44 -0700
commit3917d0e0333fea2f382ae2b7a2cf625fc28f9d98 (patch)
tree2d384e199ef9f8d61c1c7ab6661f810fcefef856 /src/libstd
parent87e129ee694b876b037abef0692496b02c17565b (diff)
parent0a6b862ccd428e317f1cfc65213fbedc0c4e5e05 (diff)
downloadrust-3917d0e0333fea2f382ae2b7a2cf625fc28f9d98.tar.gz
rust-3917d0e0333fea2f382ae2b7a2cf625fc28f9d98.zip
Rollup merge of #35436 - frewsxcv:into-vec, r=GuillaumeGomez
Add doc example for `std::ffi::NulError::into_vec`.

None
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/ffi/c_str.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs
index f800a6e228e..e0501f9cc61 100644
--- a/src/libstd/ffi/c_str.rs
+++ b/src/libstd/ffi/c_str.rs
@@ -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 }
 }