/// The function attempts to convert a Protobuf chunk into a GossipChunk.
The function attempts to convert a Protobuf chunk into a GossipChunk.
The function attempts to convert a Protobuf chunk into a GossipChunk .
fn try_from(gossip_chunk: pb::GossipChunk) -> Result<Self, Self::Error> {
        let response = try_from_option_field(gossip_chunk.response, "GossipChunk.response")?;
        let chunk_id = ChunkId::from(gossip_chunk.chunk_id);
        Ok(Self {
            artifact_id: deserialize(&gossip_chunk.artifact_id)?,
            chunk_id,
            artifact_chunk: match response {
                Response::Chunk(c) => Ok(add_chunk_id(c.try_into()?, chunk_id)),
                Response::Error(_e) => Err(P2PError {
                    p2p_error_code: P2PErrorCode::NotFound,
                }),
            },
        })
    }
fn try_from ( gossip_chunk : pb :: GossipChunk ) -> Result < Self , Self :: Error > { let response = try_from_option_field ( gossip_chunk . response , " " ) ? ; let chunk_id = ChunkId :: from ( gossip_chunk . chunk_id ) ; Ok ( Self { artifact_id : deserialize ( & gossip_chunk . artifact_id ) ? , chunk_id , artifact_chunk : match response { Response :: Chunk ( c ) => Ok ( add_chunk_id ( c . try_into ( ) ? , chunk_id ) ) , Response :: Error ( _e ) => Err ( P2PError { p2p_error_code : P2PErrorCode :: NotFound , } ) , } , } ) }
The function attempts to convert a Protobuf chunk into a GossipChunk.
The function attempts to convert a Protobuf chunk into a GossipChunk .
gossip_chunk
pb::GossipChunk