pub(crate) fn erasure_shard(self) -> Result<Vec<u8>, Error> {
        if self.payload.len() != SHRED_PAYLOAD_SIZE {
            return Err(Error::InvalidPayloadSize(self.payload.len()));
        }
        let shred_type = self.shred_type();
        let mut shard = self.payload;
        match shred_type {
            ShredType::Data => {
                shard.resize(ENCODED_PAYLOAD_SIZE, 0u8);
            }
            ShredType::Code => {
                // SIZE_OF_CODING_SHRED_HEADERS bytes at the beginning of the
                // coding shreds contains the header and is not part of erasure
                // coding.
                shard.drain(..SIZE_OF_CODING_SHRED_HEADERS);
            }
        }
        Ok(shard)
    }
// Returns the portion of the shred's payload which is erasure coded.
Returns the portion of the shred's payload which is erasure coded.
Returns the portion of the shred ' s payload which is erasure coded .
pub(crate) fn erasure_shard(self) -> Result<Vec<u8>, Error> {
        if self.payload.len() != SHRED_PAYLOAD_SIZE {
            return Err(Error::InvalidPayloadSize(self.payload.len()));
        }
        let shred_type = self.shred_type();
        let mut shard = self.payload;
        match shred_type {
            ShredType::Data => {
                shard.resize(ENCODED_PAYLOAD_SIZE, 0u8);
            }
            ShredType::Code => {
                // SIZE_OF_CODING_SHRED_HEADERS bytes at the beginning of the
                // coding shreds contains the header and is not part of erasure
                // coding.
                shard.drain(..SIZE_OF_CODING_SHRED_HEADERS);
            }
        }
        Ok(shard)
    }
pub ( crate ) fn erasure_shard ( self ) -> Result < Vec < u8 > , Error > { if self . payload . len ( ) != SHRED_PAYLOAD_SIZE { return Err ( Error :: InvalidPayloadSize ( self . payload . len ( ) ) ) ; } let shred_type = self . shred_type ( ) ; let mut shard = self . payload ; match shred_type { ShredType :: Data => { shard . resize ( ENCODED_PAYLOAD_SIZE , 0u8 ) ; } ShredType :: Code => { // SIZE_OF_CODING_SHRED_HEADERS bytes at the beginning of the // coding shreds contains the header and is not part of erasure // coding. shard . drain ( .. SIZE_OF_CODING_SHRED_HEADERS ) ; } } Ok ( shard ) }
Returns the portion of the shred's payload which is erasure coded.
Returns the portion of the shred ' s payload which is erasure coded .
self
self