fn update_field_buf(&mut self, field: &Fields, new_data: &[u8]) {
        let mut offset_into_chunk = self.offsets[*field as usize];

        // At least one record will be written in even if it exceeds SIZE_LIMIT (for variable sized fields).
        if offset_into_chunk > 0 && offset_into_chunk + new_data.len() > SIZE_LIMIT {
            self.flush(field);
            offset_into_chunk = 0;
        }

        let cur_chunk = &mut self.chunks[*field as usize];
        if cur_chunk.len() < SIZE_LIMIT {
            cur_chunk.resize(std::cmp::max(new_data.len(), SIZE_LIMIT), 0);
        }
        let item_counter = &mut self.num_items[*field as usize];

        cur_chunk[offset_into_chunk..offset_into_chunk + new_data.len()].clone_from_slice(new_data);
        offset_into_chunk += new_data.len();

        self.offsets[*field as usize] = offset_into_chunk;
        *item_counter += 1;
    }
/// Used to write new data into buffers
Used to write new data into buffers
Used to write new data into buffers
fn update_field_buf(&mut self, field: &Fields, new_data: &[u8]) {
        let mut offset_into_chunk = self.offsets[*field as usize];
        // At least one record will be written in even if it exceeds SIZE_LIMIT (for variable sized fields).
        if offset_into_chunk > 0 && offset_into_chunk + new_data.len() > SIZE_LIMIT {
            self.flush(field);
            offset_into_chunk = 0;
        }
        let cur_chunk = &mut self.chunks[*field as usize];
        if cur_chunk.len() < SIZE_LIMIT {
            cur_chunk.resize(std::cmp::max(new_data.len(), SIZE_LIMIT), 0);
        }
        let item_counter = &mut self.num_items[*field as usize];
        cur_chunk[offset_into_chunk..offset_into_chunk + new_data.len()].clone_from_slice(new_data);
        offset_into_chunk += new_data.len();
        self.offsets[*field as usize] = offset_into_chunk;
        *item_counter += 1;
    }
fn update_field_buf ( & mut self , field : & Fields , new_data : & [ u8 ] ) { let mut offset_into_chunk = self . offsets [ * field as usize ] ; // At least one record will be written in even if it exceeds SIZE_LIMIT (for variable sized fields). if offset_into_chunk > 0 && offset_into_chunk + new_data . len ( ) > SIZE_LIMIT { self . flush ( field ) ; offset_into_chunk = 0 ; } let cur_chunk = & mut self . chunks [ * field as usize ] ; if cur_chunk . len ( ) < SIZE_LIMIT { cur_chunk . resize ( std :: cmp :: max ( new_data . len ( ) , SIZE_LIMIT ) , 0 ) ; } let item_counter = & mut self . num_items [ * field as usize ] ; cur_chunk [ offset_into_chunk .. offset_into_chunk + new_data . len ( ) ] . clone_from_slice ( new_data ) ; offset_into_chunk += new_data . len ( ) ; self . offsets [ * field as usize ] = offset_into_chunk ; * item_counter += 1 ; }
Used to write new data into buffers
Used to write new data into buffers
&mut self
field
&Fields
new_data
&[u8]
&mut self
field
&Fields
new_data
&[u8]