Major amounts of progress
This commit is contained in:
@@ -4,7 +4,7 @@ use std::collections::HashMap;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ItemLibrary {
|
||||
map: HashMap<String, Item>,
|
||||
map: HashMap<String, Box<Item>>,
|
||||
list: Vec<String>,
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ impl ItemLibrary {
|
||||
}
|
||||
}
|
||||
|
||||
impl DataLibrary<'_, Item> for ItemLibrary {
|
||||
fn map(&self) -> &HashMap<String, Item> {
|
||||
impl DataLibrary<'_, Box<Item>> for ItemLibrary {
|
||||
fn map(&self) -> &HashMap<String, Box<Item>> {
|
||||
&self.map
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ impl DataLibrary<'_, Item> for ItemLibrary {
|
||||
&self.list
|
||||
}
|
||||
|
||||
fn get_modify(&mut self) -> (&mut HashMap<String, Item>, &mut Vec<String>) {
|
||||
fn get_modify(&mut self) -> (&mut HashMap<String, Box<Item>>, &mut Vec<String>) {
|
||||
(&mut self.map, &mut self.list)
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ pub mod tests {
|
||||
let m = build_item();
|
||||
// Borrow as mut so we can insert
|
||||
let w = &mut lib;
|
||||
w.add("foo", m);
|
||||
w.add("foo", Box::from(m));
|
||||
// Drops borrow as mut
|
||||
|
||||
lib
|
||||
|
||||
Reference in New Issue
Block a user