1
Fork 0

core: Trait-ify various overloaded operators

This commit is contained in:
Patrick Walton 2012-07-27 14:51:19 -07:00
parent b6aadf56c8
commit 01e2471cb7
7 changed files with 55 additions and 5 deletions

View file

@ -1897,7 +1897,6 @@ trait unique_str {
fn trim() -> self;
fn trim_left() -> self;
fn trim_right() -> self;
pure fn +(rhs: &str) -> self;
}
/// Extension methods for strings
@ -1919,6 +1918,13 @@ impl extensions of unique_str for ~str {
}
}
impl extensions of ops::add<&str,~str> for ~str {
#[inline(always)]
pure fn add(rhs: &str) -> ~str {
append(self, rhs)
}
}
trait str_slice {
fn all(it: fn(char) -> bool) -> bool;
fn any(it: fn(char) -> bool) -> bool;