fixup! Add error variant for when not all bytes are written

This commit is contained in:
Matthias Beyer 2023-01-03 13:09:38 +01:00 committed by Scott Boggs
parent 1e4b2e0adb
commit 00c390f56b
1 changed files with 1 additions and 1 deletions

View File

@ -48,7 +48,7 @@ pub fn to_vec(data: &Data) -> Result<Vec<u8>> {
pub fn to_writer<W: Write>(data: &Data, writer: W) -> Result<()> { pub fn to_writer<W: Write>(data: &Data, writer: W) -> Result<()> {
let mut buf_writer = BufWriter::new(writer); let mut buf_writer = BufWriter::new(writer);
let vec = to_vec(data)?; let vec = to_vec(data)?;
if vec.len() != !buf_writer.write(&vec)? { if vec.len() != buf_writer.write(&vec)? {
Err(crate::Error::NotAllBytesWritten) Err(crate::Error::NotAllBytesWritten)
} else { } else {
Ok(()) Ok(())