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: pod_devices.rs
    path of file: ./repos/krustlet/crates/kubelet/src/resources/device_plugin_manager
    
    the code of the file until where you have to start completion: use super::DeviceIdMap;
use crate::device_plugin_api::v1beta1::ContainerAllocateResponse;
use k8s_openapi::api::core::v1::Pod;
use kube::api::{Api, ListParams};
use std::collections::{HashMap, HashSet};
use std::sync::{Arc, Mutex};

/// `DeviceAllocateInfo` contains the device ids reserved to a container for a specific resource and
/// the ContainerAllocateResponse which contains information about what to mount into the container
#[derive(Clone, Debug)]
pub struct DeviceAllocateInfo {
    /// Contains the device Ids allocated to this container for the given resource name
    pub device_ids: HashSet<String>,
    /// Contains the RPC ContainerAllocateResponse for the device_ids
    pub allocate_response: ContainerAllocateResponse,
}
/// Map of devices allocated to the container, keyed by resource name
type ResourceAllocateInfo = HashMap<String,
    
    pub fn get_allocated_devices(&self) -> DeviceIdMap {
        let allocated_devices = self.allocated_devices.lock().unwrap().clone();
        let mut res: DeviceIdMap = HashMap::new();
        allocated_devices
            .iter()
            .for_each(|(_p_uid, container_map)| {
                container_map
                    .iter()
                    .for_each(|(_container_name, container_devs)| {
                        container_devs
                            .iter()
                            .for_each(|(resource_name, device_allocate_info)| {
                                if let Some(device_ids) = res.get_mut(resource_name) {
                                    device_allocate_info.device_ids.iter().for_each(|id| {
                                        device_ids.insert(id.clone());
                                    });
                                } else {
                                    res.insert(
                                        resource_name.clone(),
                                        device_allocate_info.device_ids.clone(),
                                    );
                                }
                            });
                    });
            });
        res
    }