Add a read_32_bytes helper method.
These are starting to stack up but I think until generic arrays arrive the cure is worse than the disease :S
This commit is contained in:
parent
44b855aab8
commit
64b210b53c
|
@ -236,6 +236,14 @@ pub trait ReadZcashExt: io::Read {
|
||||||
self.read_exact(&mut bytes)?;
|
self.read_exact(&mut bytes)?;
|
||||||
Ok(bytes)
|
Ok(bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Convenience method to read a `[u8; 32]`.
|
||||||
|
#[inline]
|
||||||
|
fn read_32_bytes(&mut self) -> io::Result<[u8; 32]> {
|
||||||
|
let mut bytes = [0; 32];
|
||||||
|
self.read_exact(&mut bytes)?;
|
||||||
|
Ok(bytes)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Mark all types implementing `Read` as implementing the extension.
|
/// Mark all types implementing `Read` as implementing the extension.
|
||||||
|
|
Loading…
Reference in New Issue