std: Rename the ToStr trait to ToString, and to_str to to_string.

[breaking-change]
This commit is contained in:
Richo Healey 2014-06-21 03:39:03 -07:00 committed by Brian Anderson
parent bfe4ddfdea
commit 12c334a77b
208 changed files with 1557 additions and 1390 deletions

View file

@ -465,7 +465,7 @@ fn stringifier(channel: &DuplexStream<String, uint>) {
let mut value: uint;
loop {
value = channel.recv();
channel.send(value.to_str());
channel.send(value.to_string());
if value == 0 { break; }
}
}
@ -478,7 +478,7 @@ send strings (the first type parameter) and receive `uint` messages
(the second type parameter). The body itself simply loops, reading
from the channel and then sending its response back. The actual
response itself is simply the stringified version of the received value,
`uint::to_str(value)`.
`uint::to_string(value)`.
Here is the code for the parent task:
@ -492,7 +492,7 @@ use std::comm::duplex;
# let mut value: uint;
# loop {
# value = channel.recv();
# channel.send(value.to_str());
# channel.send(value.to_string());
# if value == 0u { break; }
# }
# }

View file

@ -23,7 +23,7 @@ msgstr ""
#| "[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz [win-exe]: "
#| "http://static.rust-lang.org/dist/rust-nightly-install.exe"
msgid ""
"Use [`ToStr`](http://static.rust-lang.org/doc/master/std/to_str/trait.ToStr."
"Use [`ToString`](http://static.rust-lang.org/doc/master/std/to_str/trait.ToString."
"html)."
msgstr ""
"[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
@ -34,7 +34,7 @@ msgstr ""
#, fuzzy
#| msgid ""
#| "~~~~ let x: f64 = 4.0; let y: uint = x as uint; assert!(y == 4u); ~~~~"
msgid "~~~ let x: int = 42; let y: String = x.to_str(); ~~~"
msgid "~~~ let x: int = 42; let y: String = x.to_string(); ~~~"
msgstr ""
"~~~~\n"
"let x: f64 = 4.0;\n"

View file

@ -1656,7 +1656,7 @@ msgstr ""
#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
msgid ""
"impl Printable for int {\n"
" fn to_string(&self) -> String { self.to_str() }\n"
" fn to_string(&self) -> String { self.to_string() }\n"
"}\n"
msgstr ""
"~~~~ {.ignore}\n"

View file

@ -4410,9 +4410,9 @@ msgstr ""
#. type: Plain text
#: src/doc/tutorial.md:2528
msgid "#[deriving(Rand, ToStr)] enum ABC { A, B, C } ~~~"
msgid "#[deriving(Rand, ToString)] enum ABC { A, B, C } ~~~"
msgstr ""
"#[deriving(Rand, ToStr)]\n"
"#[deriving(Rand, ToString)]\n"
"enum ABC { A, B, C }\n"
"~~~"
@ -4422,15 +4422,15 @@ msgstr ""
#| msgid ""
#| "The full list of derivable traits is `Eq`, `TotalEq`, `Ord`, `TotalOrd`, "
#| "`Encodable` `Decodable`, `Clone`, `DeepClone`, `Hash`, `Rand`, "
#| "`Zero`, and `ToStr`."
#| "`Zero`, and `ToString`."
msgid ""
"The full list of derivable traits is `Eq`, `TotalEq`, `Ord`, `TotalOrd`, "
"`Encodable` `Decodable`, `Clone`, `DeepClone`, `Hash`, `Rand`, "
"`Default`, `Zero`, and `ToStr`."
"`Default`, `Zero`, and `ToString`."
msgstr ""
"実装を自動的に導出可能なトレイトは、 `Eq`, `TotalEq`, `Ord`, `TotalOrd`, "
"`Encodable` `Decodable`, `Clone`, `DeepClone`, `Hash`, `Rand`, `Zero`, "
"および `ToStr` です。."
"および `ToString` です。."
#. type: Plain text
#: src/doc/tutorial.md:2534

View file

@ -3671,15 +3671,15 @@ An example of an object type:
~~~~
trait Printable {
fn to_string(&self) -> String;
fn stringify(&self) -> String;
}
impl Printable for int {
fn to_string(&self) -> String { self.to_str() }
fn stringify(&self) -> String { self.to_string() }
}
fn print(a: Box<Printable>) {
println!("{}", a.to_string());
println!("{}", a.stringify());
}
fn main() {