// Like Shred::erasure_shard but returning a slice.
Like Shred::erasure_shard but returning a slice.
Like Shred :: erasure_shard but returning a slice .
pub(crate) fn erasure_shard_as_slice(&self) -> Result<&[u8], Error> {
        if self.payload.len() != SHRED_PAYLOAD_SIZE {
            return Err(Error::InvalidPayloadSize(self.payload.len()));
        }
        Ok(match self.shred_type() {
            ShredType::Data => &self.payload[..ENCODED_PAYLOAD_SIZE],
            ShredType::Code => &self.payload[SIZE_OF_CODING_SHRED_HEADERS..],
        })
    }
pub ( crate ) fn erasure_shard_as_slice ( & self ) -> Result < & [ u8 ] , Error > { if self . payload . len ( ) != SHRED_PAYLOAD_SIZE { return Err ( Error :: InvalidPayloadSize ( self . payload . len ( ) ) ) ; } Ok ( match self . shred_type ( ) { ShredType :: Data => & self . payload [ .. ENCODED_PAYLOAD_SIZE ] , ShredType :: Code => & self . payload [ SIZE_OF_CODING_SHRED_HEADERS .. ] , } ) }
Like Shred::erasure_shard but returning a slice.
Like Shred :: erasure_shard but returning a slice .
&self