/// Reads all raw data from a given extent leaf node.
Reads all raw data from a given extent leaf node.
Reads all raw data from a given extent leaf node .
fn extent_data(&self, extent: &Extent, mut allowance: u64) -> Result<Vec<u8>, ParsingError> {
        let block_number = extent.target_block_num();
        let block_count = extent.e_len.get() as u64;
        let block_size = self.block_size()?;
        let mut read_len;
        let mut data = Vec::with_capacity((block_size * block_count).try_into().unwrap());
        for i in 0..block_count {
            let block_data = self.block(block_number + i as u64)?;
            if allowance >= block_size {
                read_len = block_size;
            } else {
                read_len = allowance;
            }
            let block_data = &block_data[0..read_len.try_into().unwrap()];
            data.append(&mut block_data.to_vec());
            allowance -= read_len;
        }
        Ok(data)
    }
fn extent_data ( & self , extent : & Extent , mut allowance : u64 ) -> Result < Vec < u8 > , ParsingError > { let block_number = extent . target_block_num ( ) ; let block_count = extent . e_len . get ( ) as u64 ; let block_size = self . block_size ( ) ? ; let mut read_len ; let mut data = Vec :: with_capacity ( ( block_size * block_count ) . try_into ( ) . unwrap ( ) ) ; for i in 0 .. block_count { let block_data = self . block ( block_number + i as u64 ) ? ; if allowance >= block_size { read_len = block_size ; } else { read_len = allowance ; } let block_data = & block_data [ 0 .. read_len . try_into ( ) . unwrap ( ) ] ; data . append ( & mut block_data . to_vec ( ) ) ; allowance -= read_len ; } Ok ( data ) }
Reads all raw data from a given extent leaf node.
Reads all raw data from a given extent leaf node .
&self
extent
&Extent
allowance
u64