Add 32byte and 64 bytes convenience writer methods to WriteExt

This commit is contained in:
Deirdre Connolly 2020-08-09 18:41:10 -04:00 committed by Deirdre Connolly
parent e8fdd0e1f3
commit 13b6ff1c65
1 changed files with 12 additions and 0 deletions

View File

@ -174,6 +174,18 @@ pub trait WriteZcashExt: io::Write {
self.write_compactsize(string.len() as u64)?;
self.write_all(string.as_bytes())
}
/// Convenience method to write exactly 32 u8's.
#[inline]
fn write_32_bytes(&mut self, bytes: &[u8; 32]) -> io::Result<()> {
self.write_all(bytes)
}
/// Convenience method to write exactly 64 u8's.
#[inline]
fn write_64_bytes(&mut self, bytes: &[u8; 64]) -> io::Result<()> {
self.write_all(bytes)
}
}
/// Mark all types implementing `Write` as implementing the extension.