diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-04-14 10:55:45 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-04-14 10:55:45 -0700 |
| commit | 83d79c6f4c7a3f3f33eebf0b4ff2fb9c0c5e33f6 (patch) | |
| tree | a761105bc7d060fbc49350e9ef29a1e72c1e60f8 /src/libstd/ffi | |
| parent | 9f7b6cbe96990348b29e5ef27dbaa25ff3c07599 (diff) | |
| parent | 12d21bf99c1341d273ffcf0cbf4ba8c5d1d42a12 (diff) | |
| download | rust-83d79c6f4c7a3f3f33eebf0b4ff2fb9c0c5e33f6.tar.gz rust-83d79c6f4c7a3f3f33eebf0b4ff2fb9c0c5e33f6.zip | |
rollup merge of #24350: tbelaire/cstring-doc-from-vec
It looks like `from_vec` was subsumed by new at some point, but the documentation still refers to it as `from_vec`. This updates the documentation for `from_vec_unchecked` so that it properly says that it's the unchecked version of `new`. Also, from_vec_unchecked requires a actual Vec<u8> while new can take anything that is Into<Vec<u8>>, so I also mention that in the documentation. Since this is documentation: r? @steveklabnik
Diffstat (limited to 'src/libstd/ffi')
| -rw-r--r-- | src/libstd/ffi/c_str.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index d510ee48a16..78e21bdd14e 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -170,8 +170,9 @@ impl CString { /// Create a C-compatible string from a byte vector without checking for /// interior 0 bytes. /// - /// This method is equivalent to `from_vec` except that no runtime assertion - /// is made that `v` contains no 0 bytes. + /// This method is equivalent to `new` except that no runtime assertion + /// is made that `v` contains no 0 bytes, and it requires an actual + /// byte vector, not anyhting that can be converted to one with Into. #[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn from_vec_unchecked(mut v: Vec<u8>) -> CString { v.push(0); @@ -213,7 +214,7 @@ impl fmt::Debug for CString { impl NulError { /// Returns the position of the nul byte in the slice that was provided to - /// `CString::from_vec`. + /// `CString::new`. #[stable(feature = "rust1", since = "1.0.0")] pub fn nul_position(&self) -> usize { self.0 } |
