mraphics_core/render/
conveyor_manager.rs

1use std::collections::HashMap;
2
3use crate::Conveyor;
4
5pub struct ConveyorManager {
6    pub conveyor_pool: HashMap<String, Conveyor>,
7}
8
9impl ConveyorManager {
10    pub fn new() -> Self {
11        Self {
12            conveyor_pool: HashMap::new(),
13        }
14    }
15
16    pub fn acquire_attr_conveyor(&mut self, identifier: &str) -> &mut Conveyor {
17        if !self.conveyor_pool.contains_key(identifier) {
18            let conveyor = Conveyor::new();
19            self.conveyor_pool.insert(identifier.to_string(), conveyor);
20        }
21
22        // SAFETY: Checked upon
23        self.conveyor_pool.get_mut(identifier).unwrap()
24    }
25}