Skip to content

Commit

Permalink
Move IntoString to collections::string
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanzab committed Nov 16, 2014
1 parent 2d8ca04 commit 59abf75
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
6 changes: 6 additions & 0 deletions src/libcollections/string.rs
Expand Up @@ -802,6 +802,12 @@ impl FromStr for String {
}
}

/// Trait for converting a type to a string, consuming it in the process.
pub trait IntoString {
/// Consume and convert to a string.
fn into_string(self) -> String;
}

/// Unsafe operations
#[unstable = "waiting on raw module conventions"]
pub mod raw {
Expand Down
3 changes: 1 addition & 2 deletions src/libstd/ascii.rs
Expand Up @@ -21,8 +21,7 @@ use mem;
use option::{Option, Some, None};
use slice::{SlicePrelude, AsSlice};
use str::{Str, StrPrelude};
use string::{mod, String};
use to_string::IntoString;
use string::{mod, String, IntoString};
use vec::Vec;

/// Datatype to hold one ascii character. It wraps a `u8`, with the highest bit always zero.
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/prelude.rs
Expand Up @@ -76,14 +76,14 @@
#[doc(no_inline)] pub use io::{Buffer, Writer, Reader, Seek};
#[doc(no_inline)] pub use str::{Str, StrVector, StrPrelude};
#[doc(no_inline)] pub use str::{IntoMaybeOwned, StrAllocating, UnicodeStrPrelude};
#[doc(no_inline)] pub use to_string::{ToString, IntoString};
#[doc(no_inline)] pub use to_string::ToString;
#[doc(no_inline)] pub use tuple::{Tuple1, Tuple2, Tuple3, Tuple4};
#[doc(no_inline)] pub use tuple::{Tuple5, Tuple6, Tuple7, Tuple8};
#[doc(no_inline)] pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12};
#[doc(no_inline)] pub use slice::{SlicePrelude, AsSlice, CloneSlicePrelude};
#[doc(no_inline)] pub use slice::{VectorVector, PartialEqSlicePrelude, OrdSlicePrelude};
#[doc(no_inline)] pub use slice::{CloneSliceAllocPrelude, OrdSliceAllocPrelude, SliceAllocPrelude};
#[doc(no_inline)] pub use string::String;
#[doc(no_inline)] pub use string::{IntoString, String};
#[doc(no_inline)] pub use vec::Vec;

// Reexported runtime types
Expand Down
6 changes: 0 additions & 6 deletions src/libstd/to_string.rs
Expand Up @@ -25,12 +25,6 @@ pub trait ToString {
fn to_string(&self) -> String;
}

/// Trait for converting a type to a string, consuming it in the process.
pub trait IntoString {
/// Consume and convert to a string.
fn into_string(self) -> String;
}

impl<T: fmt::Show> ToString for T {
fn to_string(&self) -> String {
format!("{}", *self)
Expand Down

0 comments on commit 59abf75

Please sign in to comment.