You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: chunked_vectors.rs
    path of file: ./repos/qdrant/lib/segment/src/vector_storage
    
    the code of the file until where you have to start completion: use std::cmp::max;
use std::collections::TryReserveError;
use std::fs::File;
use std::io::{Read, Write};
use std::mem;
use std::path::Path;

use common::types::PointOffsetType;

use crate::common::vector_utils::{TrySetCapacity, TrySetCapacityExact};

// chunk size in bytes
const CHUNK_SIZE: usize = 32 * 1024 * 1024;

// if dime
    
    fn try_set_capacity_exact(&mut self, capacity: usize) -> Result<(), TryReserveError> {
        let num_chunks = capacity.div_ceil(self.chunk_capacity);
        let last_chunk_idx = capacity / self.chunk_capacity;
        self.chunks.try_set_capacity_exact(num_chunks)?;
        self.chunks.resize_with(num_chunks, Vec::new);
        for chunk_idx in 0..num_chunks {
            if chunk_idx == last_chunk_idx {
                let desired_capacity = (capacity % self.chunk_capacity) * self.dim;
                self.chunks[chunk_idx].try_set_capacity_exact(desired_capacity)?;
            } else {
                let desired_capacity = self.chunk_capacity * self.dim;
                self.chunks[chunk_idx].try_set_capacity_exact(desired_capacity)?;
            }
        }
        Ok(())
    }