core: Implement ToStr for @str

This commit is contained in:
Philipp Brüschweiler 2012-09-12 21:15:27 +02:00 committed by Graydon Hoare
parent 7568dd4564
commit 7a6df9c90f
1 changed files with 4 additions and 0 deletions

View File

@ -49,6 +49,9 @@ impl ~str: ToStr {
impl &str: ToStr {
fn to_str() -> ~str { str::from_slice(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 {
@ -96,6 +99,7 @@ mod tests {
assert false.to_str() == ~"false";
assert ().to_str() == ~"()";
assert (~"hi").to_str() == ~"hi";
assert (@"hi").to_str() == ~"hi";
}
#[test]