Mercurial > lbo > hg > localmr
changeset 32:9e6cdeb49c8c
Fix shard() trait method
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Sun, 31 Jan 2016 19:32:48 +0000 |
parents | ce0ed262a105 |
children | def737737bc8 |
files | src/mapreducer.rs |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/mapreducer.rs Sun Jan 31 19:32:24 2016 +0000 +++ b/src/mapreducer.rs Sun Jan 31 19:32:48 2016 +0000 @@ -90,9 +90,9 @@ /// Determines how to map keys to (reduce) shards. /// Returns a number in [0; n) determining the shard the key belongs in. /// The default implementation uses a simple hash (SipHasher) and modulo. - fn shard(n: u32, key: &String) -> u32 { + fn shard(&self, n: usize, key: &String) -> usize { let mut h = SipHasher::new(); h.write(key.as_bytes()); - h.finish() as u32 % n + h.finish() as usize % n } }