MCPcopy Index your code
hub / github.com/RustPython/RustPython / hash_iter

Method hash_iter

crates/common/src/hash.rs:58–69  ·  view source on GitHub ↗
(&self, iter: I, hash_func: F)

Source from the content-addressed store, hash-verified

56 }
57
58 pub fn hash_iter<'a, T: 'a, I, F, E>(&self, iter: I, hash_func: F) -> Result<PyHash, E>
59 where
60 I: IntoIterator<Item = &'a T>,
61 F: Fn(&'a T) -> Result<PyHash, E>,
62 {
63 let mut hasher = self.build_hasher();
64 for element in iter {
65 let item_hash = hash_func(element)?;
66 item_hash.hash(&mut hasher);
67 }
68 Ok(fix_sentinel(mod_int(hasher.finish() as PyHash)))
69 }
70
71 pub fn hash_bytes(&self, value: &[u8]) -> PyHash {
72 if value.is_empty() {

Callers 1

hash_iterFunction · 0.80

Calls 5

fix_sentinelFunction · 0.85
mod_intFunction · 0.85
build_hasherMethod · 0.80
hashMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected