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: dynamic_pool.rs
    path of file: ./repos/qdrant/lib/api/src/grpc
    
    the code of the file until where you have to start completion: use std::collections::HashMap;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::time::{Duration, Instant};

use rand::Rng;

#[derive(Debug)]
struct ItemWithStats<T: Clone> {
    pub item: T,
    pub 
    
    pub fn choose(&mut self) -> Option<CountedItem<T>> {
        if self.items.len() < self.min_items {
            return None;
        }

        // If all items are used too much, we cannot use any of them so we return None
        let mut total_usage = 0;
        let min_usage_idx = *self
            .items
            .iter()
            .map(|(idx, item)| {
                let usage = item.usage.load(Ordering::Relaxed);
                total_usage += usage;
                (idx, usage)
            })
            .filter(|(_, min_usage)| *min_usage < self.max_usage_per_item)
            .min_by_key(|(_, usage)| *usage)?
            .0;

        let current_usage_capacity = self.items.len().saturating_mul(self.max_usage_per_item);

        if current_usage_capacity.saturating_sub(total_usage)
            > self.max_usage_per_item.saturating_mul(2)
            && self.items.len() > self.min_items
        {
            // We have too many items, and we have enough capacity to remove some of them
            let item = self
                .items
                .remove(&min_usage_idx)
                .expect("Item must exist, as we just found it");
            return Some(CountedItem::new(min_usage_idx, item, self.init_at));
        }

        Some(CountedItem::new(
            min_usage_idx,
            self.items
                .get(&min_usage_idx)
                .expect("Item must exist, as we just found it")
                .clone(),
            self.init_at,
        ))
    }