Remove lifetime mess, replace a lot of code with Arc instead of borrows.
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This cleans up the codebase massively, and allows me to maintain some semblance of sanity.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use indexmap::IndexMap;
|
||||
|
||||
use crate::static_data::Ability;
|
||||
@@ -8,7 +10,7 @@ use crate::StringKey;
|
||||
#[derive(Debug)]
|
||||
pub struct AbilityLibrary {
|
||||
/// The underlying map for the library.
|
||||
map: IndexMap<StringKey, Box<Ability>>,
|
||||
map: IndexMap<StringKey, Arc<Ability>>,
|
||||
}
|
||||
|
||||
impl AbilityLibrary {
|
||||
@@ -20,11 +22,11 @@ impl AbilityLibrary {
|
||||
}
|
||||
}
|
||||
|
||||
impl DataLibrary<'_, Box<Ability>> for AbilityLibrary {
|
||||
fn map(&self) -> &IndexMap<StringKey, Box<Ability>> {
|
||||
impl DataLibrary<'_, Ability> for AbilityLibrary {
|
||||
fn map(&self) -> &IndexMap<StringKey, Arc<Ability>> {
|
||||
&self.map
|
||||
}
|
||||
fn get_modify(&mut self) -> &mut IndexMap<StringKey, Box<Ability>> {
|
||||
fn get_modify(&mut self) -> &mut IndexMap<StringKey, Arc<Ability>> {
|
||||
&mut self.map
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user