libcore: Add an implementation of to_str for &str.
It duplicates the string.
This commit is contained in:
parent
09df8f1abf
commit
7d86429415
1 changed files with 3 additions and 0 deletions
|
@ -46,6 +46,9 @@ impl (): ToStr {
|
||||||
impl ~str: ToStr {
|
impl ~str: ToStr {
|
||||||
fn to_str() -> ~str { self }
|
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 {
|
impl<A: ToStr copy, B: ToStr copy> (A, B): ToStr {
|
||||||
fn to_str() -> ~str {
|
fn to_str() -> ~str {
|
||||||
|
|
Loading…
Reference in a new issue