| 1 | use craterust-analyzer cargo hash32 0.3.1 crate/::Hasherrust-analyzer cargo hash32 0.3.1 Hasher# as _; |
| 2 | |
| 3 | const BASISrust-analyzer cargo hash32 0.3.1 fnv/BASIS.: u32 = 0x811c9dc5; |
| 4 | const PRIMErust-analyzer cargo hash32 0.3.1 fnv/PRIME.: u32 = 0x1000193; |
| 5 | |
| 6 | /// 32-bit Fowler-Noll-Vo hasher |
| 7 | pub struct Hasherrust-analyzer cargo hash32 0.3.1 fnv/Hasher# { |
| 8 | staterust-analyzer cargo hash32 0.3.1 fnv/Hasher#state.: u32, |
| 9 | } |
| 10 | |
| 11 | impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Hasherrust-analyzer cargo hash32 0.3.1 fnv/Hasher# { |
| 12 | fn defaultrust-analyzer cargo hash32 0.3.1 fnv/impl#[Hasher][Default]default().() -> Selfrust-analyzer cargo hash32 0.3.1 fnv/impl#[Hasher][Default] { |
| 13 | Hasherrust-analyzer cargo hash32 0.3.1 fnv/Hasher# { staterust-analyzer cargo hash32 0.3.1 fnv/Hasher#state.: BASISrust-analyzer cargo hash32 0.3.1 fnv/BASIS. } |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | impl craterust-analyzer cargo hash32 0.3.1 crate/::Hasherrust-analyzer cargo hash32 0.3.1 Hasher# for Hasherrust-analyzer cargo hash32 0.3.1 fnv/Hasher# { |
| 18 | #[inline] |
| 19 | fn finish32rust-analyzer cargo hash32 0.3.1 fnv/impl#[Hasher][Hasher]finish32().(&self) -> u32 { |
| 20 | self.staterust-analyzer cargo hash32 0.3.1 fnv/Hasher#state. |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/::Hasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hasher# for Hasherrust-analyzer cargo hash32 0.3.1 fnv/Hasher# { |
| 25 | #[inline] |
| 26 | fn writerust-analyzer cargo hash32 0.3.1 fnv/impl#[Hasher][Hasher]write().(&mut self, bytes: &[u8]) { |
| 27 | for byte in bytes { |
| 28 | self.staterust-analyzer cargo hash32 0.3.1 fnv/Hasher#state. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitXorAssign<Self>`]bitxor_assign().^=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitXorAssign<Self>`]bitxor_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitXorAssign<Self>`]bitxor_assign().u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u8>`]from().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().byte); |
| 29 | self.staterust-analyzer cargo hash32 0.3.1 fnv/Hasher#state. = self.staterust-analyzer cargo hash32 0.3.1 fnv/Hasher#state..wrapping_mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]wrapping_mul().(PRIMErust-analyzer cargo hash32 0.3.1 fnv/PRIME.); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | #[inline] |
| 34 | fn finishrust-analyzer cargo hash32 0.3.1 fnv/impl#[Hasher][Hasher]finish().(&self) -> u64 { |
| 35 | self.finish32rust-analyzer cargo hash32 0.3.1 fnv/impl#[Hasher][Hasher]finish32().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 36 | } |
| 37 | } |