libcore: Add an implementation of to_str for &str.

It duplicates the string.
This commit is contained in:
Patrick Walton 2012-08-25 18:42:07 -07:00
parent 09df8f1abf
commit 7d86429415

View file

@ -46,6 +46,9 @@ impl (): ToStr {
impl ~str: ToStr {
fn to_str() -> ~str { self }
}
impl &str: ToStr {
fn to_str() -> ~str { str::from_slice(self) }
}
impl<A: ToStr copy, B: ToStr copy> (A, B): ToStr {
fn to_str() -> ~str {