diff options
| author | Theo Belaire <theo.belaire@gmail.com> | 2015-04-12 10:47:35 -0400 |
|---|---|---|
| committer | Theo Belaire <theo.belaire@gmail.com> | 2015-04-12 10:55:26 -0400 |
| commit | 12d21bf99c1341d273ffcf0cbf4ba8c5d1d42a12 (patch) | |
| tree | 30b958f90ae39dcd3bea55bd239f0c733c07e0a3 /src/libstd/ffi | |
| parent | 5afa2704a6fdee62b267a5df9ca0934350dfc3d1 (diff) | |
| download | rust-12d21bf99c1341d273ffcf0cbf4ba8c5d1d42a12.tar.gz rust-12d21bf99c1341d273ffcf0cbf4ba8c5d1d42a12.zip | |
References to `CString::from_vec` changed to `new`
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.
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 de91e5f3268..6e291558e9b 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -172,8 +172,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); @@ -215,7 +216,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 } |
