De-duplicate core::hash some, refactor the traits.
This commit is contained in:
parent
009352101d
commit
4779d2b392
5 changed files with 229 additions and 222 deletions
|
@ -8,6 +8,7 @@
|
|||
*/
|
||||
|
||||
import libc::size_t;
|
||||
import io::writer_util;
|
||||
|
||||
export
|
||||
// Creating a string
|
||||
|
@ -665,10 +666,7 @@ pure fn le(a: &~str, b: &~str) -> bool { *a <= *b }
|
|||
|
||||
/// String hash function
|
||||
pure fn hash(s: &~str) -> uint {
|
||||
let x = do as_bytes(*s) |bytes| {
|
||||
hash::hash_bytes(bytes)
|
||||
};
|
||||
return x as uint;
|
||||
hash::hash_str(*s) as uint
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue