/// Optimizes each section in this chunk.
///
/// Returns the number of sections which were actually
/// optimized - sections which have not been
/// modified since the last time they were optimized
/// are not optimized.
Optimizes each section in this chunk.
Returns the number of sections which were actually
optimized - sections which have not been
modified since the last time they were optimized
are not optimized.
Optimizes each section in this chunk . Returns the number of sections which were actually optimized - sections which have not been modified since the last time they were optimized are not optimized .
pub fn optimize(&mut self) -> u32 {
        let modified = self.modified;
        let mut count = 0;
        let mut to_remove = vec![];
        for (i, s) in self.sections.iter_mut().enumerate() {
            if let Some(section) = s {
                if section.optimize() {
                    // Section was optimized - increment count
                    count += 1;
                }
                if section.empty() {
                    to_remove.push(i);
                }
            }
        }
        for i in to_remove {
            self.set_section_at(i, None);
        }
        self.modified = modified;
        count
    }
pub fn optimize ( & mut self ) -> u32 { let modified = self . modified ; let mut count = 0 ; let mut to_remove = vec ! [ ] ; for ( i , s ) in self . sections . iter_mut ( ) . enumerate ( ) { if let Some ( section ) = s { if section . optimize ( ) { // Section was optimized - increment count count += 1 ; } if section . empty ( ) { to_remove . push ( i ) ; } } } for i in to_remove { self . set_section_at ( i , None ) ; } self . modified = modified ; count }
Optimizes each section in this chunk.
Optimizes each section in this chunk .
&mut self