diff options
Diffstat (limited to 'src/libstd/c_str.rs')
| -rw-r--r-- | src/libstd/c_str.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/libstd/c_str.rs b/src/libstd/c_str.rs index 46498610e56..6418841eda8 100644 --- a/src/libstd/c_str.rs +++ b/src/libstd/c_str.rs @@ -45,6 +45,8 @@ //! ```rust //! extern crate libc; //! +//! use std::c_str::ToCStr; +//! //! extern { //! fn puts(s: *const libc::c_char); //! } @@ -70,6 +72,7 @@ use core::prelude::*; use libc; +use cmp::Ordering; use fmt; use hash; use mem; @@ -155,6 +158,8 @@ impl CString { /// one). /// /// ```rust + /// use std::c_str::ToCStr; + /// /// let foo = "some string"; /// /// // right @@ -170,6 +175,8 @@ impl CString { /// ```rust /// extern crate libc; /// + /// use std::c_str::ToCStr; + /// /// fn main() { /// let c_str = "foo bar".to_c_str(); /// unsafe { @@ -189,6 +196,8 @@ impl CString { /// one). /// /// ```rust + /// use std::c_str::ToCStr; + /// /// let foo = "some string"; /// /// // right @@ -309,6 +318,8 @@ pub trait ToCStr for Sized? { /// ```rust /// extern crate libc; /// + /// use std::c_str::ToCStr; + /// /// fn main() { /// let s = "PATH".with_c_str(|path| unsafe { /// libc::getenv(path) @@ -539,8 +550,7 @@ pub unsafe fn from_c_multistring<F>(buf: *const libc::c_char, #[cfg(test)] mod tests { use super::*; - use prelude::{spawn, Some, None, Option, FnOnce, ToString, CloneSliceExt}; - use prelude::{Clone, PtrExt, Iterator, SliceExt, StrExt}; + use prelude::v1::*; use ptr; use thread::Thread; use libc; @@ -732,9 +742,10 @@ mod tests { mod bench { extern crate test; + use prelude::v1::*; use self::test::Bencher; use libc; - use prelude::*; + use c_str::ToCStr; #[inline] fn check(s: &str, c_str: *const libc::c_char) { |
