Skip to content

Commit

Permalink
Rename To{Str,Bytes}Consume traits to Into*.
Browse files Browse the repository at this point in the history
That is:

- `ToStrConsume` → `IntoStr`;
- `ToBytesConsume` → `IntoBytes`.
  • Loading branch information
chris-morgan committed Dec 14, 2013
1 parent 529f915 commit b76997f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/etc/vim/syntax/rust.vim
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ syn keyword rustEnumVariant Ok Err

" Types and traits {{{3
syn keyword rustTrait Any AnyOwnExt AnyRefExt AnyMutRefExt
syn keyword rustTrait Ascii AsciiCast OwnedAsciiCast AsciiStr ToBytesConsume
syn keyword rustTrait Ascii AsciiCast OwnedAsciiCast AsciiStr IntoBytes
syn keyword rustTrait Bool
syn keyword rustTrait ToCStr
syn keyword rustTrait Char
Expand Down Expand Up @@ -94,7 +94,7 @@ syn keyword rustTrait Buffer Writer Reader Seek
syn keyword rustTrait SendStr SendStrOwned SendStrStatic IntoSendStr
syn keyword rustTrait Str StrVector StrSlice OwnedStr
syn keyword rustTrait IterBytes
syn keyword rustTrait ToStr ToStrConsume
syn keyword rustTrait ToStr IntoStr
syn keyword rustTrait CopyableTuple ImmutableTuple
syn keyword rustTrait Tuple1 Tuple2 Tuple3 Tuple4
syn keyword rustTrait Tuple5 Tuple6 Tuple7 Tuple8
Expand Down
8 changes: 4 additions & 4 deletions src/libstd/ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

//! Operations on ASCII strings and characters.

use to_str::{ToStr,ToStrConsume};
use to_str::{ToStr,IntoStr};
use str;
use str::StrSlice;
use str::OwnedStr;
Expand Down Expand Up @@ -294,7 +294,7 @@ impl<'a> AsciiStr for &'a [Ascii] {
}
}

impl ToStrConsume for ~[Ascii] {
impl IntoStr for ~[Ascii] {
#[inline]
fn into_str(self) -> ~str {
unsafe { cast::transmute(self) }
Expand All @@ -309,12 +309,12 @@ impl IterBytes for Ascii {
}

/// Trait to convert to a owned byte array by consuming self
pub trait ToBytesConsume {
pub trait IntoBytes {
/// Converts to a owned byte array by consuming self
fn into_bytes(self) -> ~[u8];
}

impl ToBytesConsume for ~[Ascii] {
impl IntoBytes for ~[Ascii] {
fn into_bytes(self) -> ~[u8] {
unsafe { cast::transmute(self) }
}
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub use io::stdio::{print, println};
// Reexported types and traits

pub use any::{Any, AnyOwnExt, AnyRefExt, AnyMutRefExt};
pub use ascii::{Ascii, AsciiCast, OwnedAsciiCast, AsciiStr, ToBytesConsume};
pub use ascii::{Ascii, AsciiCast, OwnedAsciiCast, AsciiStr, IntoBytes};
pub use bool::Bool;
pub use c_str::ToCStr;
pub use char::Char;
Expand All @@ -71,7 +71,7 @@ pub use io::{Buffer, Writer, Reader, Seek};
pub use send_str::{SendStr, SendStrOwned, SendStrStatic, IntoSendStr};
pub use str::{Str, StrVector, StrSlice, OwnedStr};
pub use to_bytes::IterBytes;
pub use to_str::{ToStr, ToStrConsume};
pub use to_str::{ToStr, IntoStr};
pub use tuple::{CopyableTuple, ImmutableTuple};
pub use tuple::{ImmutableTuple1, ImmutableTuple2, ImmutableTuple3, ImmutableTuple4};
pub use tuple::{ImmutableTuple5, ImmutableTuple6, ImmutableTuple7, ImmutableTuple8};
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/to_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub trait ToStr {
}

/// Trait for converting a type to a string, consuming it in the process.
pub trait ToStrConsume {
pub trait IntoStr {
/// Consume and convert to a string.
fn into_str(self) -> ~str;
}
Expand Down

1 comment on commit b76997f

@alexcrichton
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+, thanks!

Please sign in to comment.