diff options
| author | Jack O'Connor <[email protected]> | 2020-02-03 10:20:45 -0500 |
|---|---|---|
| committer | Jack O'Connor <[email protected]> | 2020-02-03 10:21:27 -0500 |
| commit | 0651736ff45ba030a4933bf6f9cc5f38f8e87b19 (patch) | |
| tree | 0018adf5f818fee5d9521aa2562736ea11b53f31 /src | |
| parent | 9ffe377d454f8f3fbb289370b3b8ad916e33779d (diff) | |
make the inherent reset() method return &mut self
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib.rs | 3 | ||||
| -rw-r--r-- | src/traits.rs | 2 |
2 files changed, 3 insertions, 2 deletions
@@ -798,7 +798,7 @@ impl Hasher { /// how much inlining the optimizer does, moving a `Hasher` might copy its /// entire CV stack, most of which is useless uninitialized bytes. This /// methods avoids that copy. - pub fn reset(&mut self) { + pub fn reset(&mut self) -> &mut Self { self.chunk_state = ChunkState::new( &self.key, 0, @@ -806,6 +806,7 @@ impl Hasher { self.chunk_state.platform, ); self.cv_stack.clear(); + self } // As described in push_cv() below, we do "lazy merging", delaying merges diff --git a/src/traits.rs b/src/traits.rs index 0d9279d..0c24b45 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -84,7 +84,7 @@ mod test { // Trait implementations. let mut hasher2: crate::Hasher = digest::Digest::new(); digest::Digest::input(&mut hasher2, b"xxx"); - digest::Digest::reset(&mut hasher2); // avoid the reset() inherent method + digest::Digest::reset(&mut hasher2); digest::Digest::input(&mut hasher2, b"foo"); digest::Digest::input(&mut hasher2, b"bar"); digest::Digest::input(&mut hasher2, b"baz"); |
