// Serializes the artifact to protobuf.
Serializes the artifact to protobuf.
Serializes the artifact to protobuf .
fn serialize(&self) -> Result<Vec<u8>, io::Error> {
        let mut buf = Vec::new();
        use BackupArtifact::*;
        match self {
            Finalization(artifact) => pb::Finalization::from(artifact.as_ref()).encode(&mut buf),
            Notarization(artifact) => pb::Notarization::from(artifact.as_ref()).encode(&mut buf),
            BlockProposal(artifact) => pb::BlockProposal::from(artifact.as_ref()).encode(&mut buf),
            RandomTape(artifact) => pb::RandomTape::from(artifact.as_ref()).encode(&mut buf),
            RandomBeacon(artifact) => pb::RandomBeacon::from(artifact.as_ref()).encode(&mut buf),
            CatchUpPackage(artifact) => {
                pb::CatchUpPackage::from(artifact.as_ref()).encode(&mut buf)
            }
        }
        .map_err(|err| io::Error::new(io::ErrorKind::Other, err.to_string()))?;
        Ok(buf)
    }
fn serialize ( & self ) -> Result < Vec < u8 > , io :: Error > { let mut buf = Vec :: new ( ) ; use BackupArtifact :: * ; match self { Finalization ( artifact ) => pb :: Finalization :: from ( artifact . as_ref ( ) ) . encode ( & mut buf ) , Notarization ( artifact ) => pb :: Notarization :: from ( artifact . as_ref ( ) ) . encode ( & mut buf ) , BlockProposal ( artifact ) => pb :: BlockProposal :: from ( artifact . as_ref ( ) ) . encode ( & mut buf ) , RandomTape ( artifact ) => pb :: RandomTape :: from ( artifact . as_ref ( ) ) . encode ( & mut buf ) , RandomBeacon ( artifact ) => pb :: RandomBeacon :: from ( artifact . as_ref ( ) ) . encode ( & mut buf ) , CatchUpPackage ( artifact ) => { pb :: CatchUpPackage :: from ( artifact . as_ref ( ) ) . encode ( & mut buf ) } } . map_err ( | err | io :: Error :: new ( io :: ErrorKind :: Other , err . to_string ( ) ) ) ? ; Ok ( buf ) }
Serializes the artifact to protobuf.
Serializes the artifact to protobuf .
&self