diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-02-18 14:39:37 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-02-18 15:27:42 -0800 |
| commit | 365bd9a9e3b9dafa98e26982353fd28a6ca1efef (patch) | |
| tree | a4d25ce7c59172f76f94d27077389854c55f8bfe /src/libstd/ffi | |
| parent | b64dfff326a0e248227c5782eccce7ca8b02f66c (diff) | |
| download | rust-365bd9a9e3b9dafa98e26982353fd28a6ca1efef.tar.gz rust-365bd9a9e3b9dafa98e26982353fd28a6ca1efef.zip | |
Round 1 fixes and rebase conflicts
Diffstat (limited to 'src/libstd/ffi')
| -rw-r--r-- | src/libstd/ffi/c_str.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 70c14ef1978..8976813d3f9 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -105,7 +105,7 @@ pub struct CString { /// } /// /// fn main() { -/// let s = CString::from_slice(b"data data data data").unwrap(); +/// let s = CString::new("data data data data").unwrap(); /// work(&s); /// } /// ``` @@ -141,7 +141,7 @@ impl CString { /// extern { fn puts(s: *const libc::c_char); } /// /// fn main() { - /// let to_print = CString::from_slice(b"Hello!").unwrap(); + /// let to_print = CString::new("Hello!").unwrap(); /// unsafe { /// puts(to_print.as_ptr()); /// } @@ -175,7 +175,7 @@ impl CString { /// extern { fn puts(s: *const libc::c_char); } /// /// fn main() { - /// let to_print = CString::from_slice(b"Hello!").unwrap(); + /// let to_print = CString::new("Hello!").unwrap(); /// unsafe { /// puts(to_print.as_ptr()); /// } @@ -436,18 +436,18 @@ mod tests { #[test] fn simple() { - let s = CString::from_slice(b"1234").unwrap(); + let s = CString::new(b"1234").unwrap(); assert_eq!(s.as_bytes(), b"1234"); assert_eq!(s.as_bytes_with_nul(), b"1234\0"); } #[test] fn build_with_zero1() { - assert!(CString::from_slice(b"\0").is_err()); + assert!(CString::new(b"\0").is_err()); } #[test] fn build_with_zero2() { - assert!(CString::from_vec(vec![0]).is_err()); + assert!(CString::new(vec![0]).is_err()); } #[test] @@ -460,7 +460,7 @@ mod tests { #[test] fn formatted() { - let s = CString::from_slice(b"12").unwrap(); + let s = CString::new(b"12").unwrap(); assert_eq!(format!("{:?}", s), "\"12\""); } |
