miscellaneous fixes

This commit is contained in:
Aiden McClelland
2021-09-27 13:48:19 -06:00
committed by Aiden McClelland
parent 1eeffc0bf8
commit e3d8861199
12 changed files with 188 additions and 182 deletions

View File

@@ -686,6 +686,12 @@ impl<H: Digest, W: std::io::Write> HashWriter<H, W> {
pub fn finish(self) -> (H, W) {
(self.hasher, self.writer)
}
pub fn inner(&self) -> &W {
&self.writer
}
pub fn inner_mut(&mut self) -> &mut W {
&mut self.writer
}
}
impl<H: Digest, W: std::io::Write> std::io::Write for HashWriter<H, W> {
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
@@ -697,17 +703,6 @@ impl<H: Digest, W: std::io::Write> std::io::Write for HashWriter<H, W> {
self.writer.flush()
}
}
impl<H: Digest, W: std::io::Write> std::ops::Deref for HashWriter<H, W> {
type Target = W;
fn deref(&self) -> &Self::Target {
&self.writer
}
}
impl<H: Digest, W: std::io::Write> std::ops::DerefMut for HashWriter<H, W> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.writer
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct Port(pub u16);