use util::byte_utils::{be64_to_array, be48_to_array, be32_to_array, be16_to_array, slice_to_be16, slice_to_be32, slice_to_be48, slice_to_be64};
-const MAX_BUF_SIZE: usize = 64 * 1024;
+/// serialization buffer size
+pub const MAX_BUF_SIZE: usize = 64 * 1024;
/// A trait that is similar to std::io::Write but has one extra function which can be used to size
/// buffers being written into.
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), ::std::io::Error> {
match self.consensus_encode(WriterWriteAdaptor(writer)) {
Ok(_) => Ok(()),
- Err(consensus::encode::Error::Io(e)) => Err(e),
- Err(_) => panic!("We shouldn't get a consensus::encode::Error unless our Write generated an std::io::Error"),
+ Err(e) => Err(e),
}
}
}
match consensus::encode::Decodable::consensus_decode(r) {
Ok(t) => Ok(t),
Err(consensus::encode::Error::Io(ref e)) if e.kind() == ::std::io::ErrorKind::UnexpectedEof => Err(DecodeError::ShortRead),
- Err(consensus::encode::Error::Io(e)) => Err(DecodeError::Io(e)),
+ Err(consensus::encode::Error::Io(e)) => Err(DecodeError::Io(e.kind())),
Err(_) => Err(DecodeError::InvalidValue),
}
}