33 lines
785 B
Rust
33 lines
785 B
Rust
|
use crate::static_data::libraries::data_library::DataLibrary;
|
||
|
use crate::static_data::moves::move_data::MoveData;
|
||
|
use std::collections::HashMap;
|
||
|
|
||
|
#[derive(Debug)]
|
||
|
pub struct MoveLibrary {
|
||
|
map: HashMap<String, MoveData>,
|
||
|
list: Vec<String>,
|
||
|
}
|
||
|
|
||
|
impl MoveLibrary {
|
||
|
pub fn new(capacity: usize) -> MoveLibrary {
|
||
|
MoveLibrary {
|
||
|
map: HashMap::with_capacity(capacity),
|
||
|
list: Vec::with_capacity(capacity),
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl DataLibrary<'_, MoveData> for MoveLibrary {
|
||
|
fn map(&self) -> &HashMap<String, MoveData> {
|
||
|
&self.map
|
||
|
}
|
||
|
|
||
|
fn list_values(&self) -> &Vec<String> {
|
||
|
&self.list
|
||
|
}
|
||
|
|
||
|
fn get_modify(&mut self) -> (&mut HashMap<String, MoveData>, &mut Vec<String>) {
|
||
|
(&mut self.map, &mut self.list)
|
||
|
}
|
||
|
}
|