fn clear_last_chunk(&self, last_chunk: &mut TypedArenaChunk<T>) {
        // Determine how much was filled.
        let start = last_chunk.start() as usize;
        // We obtain the value of the pointer to the first uninitialized element.
        let end = self.ptr.get() as usize;
        // We then calculate the number of elements to be dropped in the last chunk,
        // which is the filled area's length.
        let diff = if mem::size_of::<T>() == 0 {
            // `T` is ZST. It can't have a drop flag, so the value here doesn't matter. We get
            // the number of zero-sized values in the last and only chunk, just out of caution.
            // Recall that `end` was incremented for each allocated value.
            end - start
        } else {
            (end - start) / mem::size_of::<T>()
        };
        // Pass that to the `destroy` method.
        unsafe {
            last_chunk.destroy(diff);
        }
        // Reset the chunk.
        self.ptr.set(last_chunk.start());
    }
// Drops the contents of the last chunk. The last chunk is partially empty, unlike all other
// chunks.
Drops the contents of the last chunk. The last chunk is partially empty, unlike all other
chunks.
Drops the contents of the last chunk . The last chunk is partially empty unlike all other chunks .
fn clear_last_chunk(&self, last_chunk: &mut TypedArenaChunk<T>) {
        // Determine how much was filled.
        let start = last_chunk.start() as usize;
        // We obtain the value of the pointer to the first uninitialized element.
        let end = self.ptr.get() as usize;
        // We then calculate the number of elements to be dropped in the last chunk,
        // which is the filled area's length.
        let diff = if mem::size_of::<T>() == 0 {
            // `T` is ZST. It can't have a drop flag, so the value here doesn't matter. We get
            // the number of zero-sized values in the last and only chunk, just out of caution.
            // Recall that `end` was incremented for each allocated value.
            end - start
        } else {
            (end - start) / mem::size_of::<T>()
        };
        // Pass that to the `destroy` method.
        unsafe {
            last_chunk.destroy(diff);
        }
        // Reset the chunk.
        self.ptr.set(last_chunk.start());
    }
fn clear_last_chunk ( & self , last_chunk : & mut TypedArenaChunk < T > ) { // Determine how much was filled. let start = last_chunk . start ( ) as usize ; // We obtain the value of the pointer to the first uninitialized element. let end = self . ptr . get ( ) as usize ; // We then calculate the number of elements to be dropped in the last chunk, // which is the filled area's length. let diff = if mem :: size_of :: < T > ( ) == 0 { // `T` is ZST. It can't have a drop flag, so the value here doesn't matter. We get // the number of zero-sized values in the last and only chunk, just out of caution. // Recall that `end` was incremented for each allocated value. end - start } else { ( end - start ) / mem :: size_of :: < T > ( ) } ; // Pass that to the `destroy` method. unsafe { last_chunk . destroy ( diff ) ; } // Reset the chunk. self . ptr . set ( last_chunk . start ( ) ) ; }
Drops the contents of the last chunk.
Drops the contents of the last chunk .
&self
last_chunk
&mut TypedArenaChunk<T>
&self
last_chunk
&mut TypedArenaChunk<T>