Skip to content
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.

Commit

Permalink
Block::serialize(): Use streaming version
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed Jan 11, 2019
1 parent 7fe2c72 commit 9465500
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cardano/src/block/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,10 @@ impl chain_core::property::Block for Block {
impl chain_core::property::Serialize for Block {
type Error = cbor_event::Error;

fn serialize<W: std::io::Write>(&self, mut writer: W) -> Result<(), Self::Error> {
let bytes = cbor!(self)?;
writer.write(&bytes)?;
fn serialize<W: std::io::Write>(&self, writer: W) -> Result<(), Self::Error> {
let mut serializer = cbor_event::se::Serializer::new(writer);
serializer.serialize(self)?;
serializer.finalize();
Ok(())
}
}
Expand Down

0 comments on commit 9465500

Please sign in to comment.