add a TotalEq trait
This commit is contained in:
parent
91cb6687a8
commit
d2b267bcb5
5 changed files with 115 additions and 24 deletions
|
@ -21,7 +21,7 @@ use at_vec;
|
|||
use cast;
|
||||
use char;
|
||||
use clone::Clone;
|
||||
use cmp::{Equiv, TotalOrd, Ordering, Less, Equal, Greater};
|
||||
use cmp::{Equiv, TotalEq, TotalOrd, Ordering, Less, Equal, Greater};
|
||||
use libc;
|
||||
use option::{None, Option, Some};
|
||||
use ptr;
|
||||
|
@ -930,6 +930,30 @@ impl Eq for @str {
|
|||
fn ne(&self, other: &@str) -> bool { !(*self).eq(other) }
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
impl<'self> TotalEq for &'self str {
|
||||
#[inline(always)]
|
||||
fn equals(&self, other: & &'self str) -> bool {
|
||||
eq_slice((*self), (*other))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
impl TotalEq for ~str {
|
||||
#[inline(always)]
|
||||
fn equals(&self, other: &~str) -> bool {
|
||||
eq_slice((*self), (*other))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
impl TotalEq for @str {
|
||||
#[inline(always)]
|
||||
fn equals(&self, other: &@str) -> bool {
|
||||
eq_slice((*self), (*other))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
impl Ord for ~str {
|
||||
#[inline(always)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue