diff --git a/src/database/db_core.rs b/src/database/db_core.rs index ac612fe..395fbd8 100644 --- a/src/database/db_core.rs +++ b/src/database/db_core.rs @@ -2,11 +2,9 @@ use super::space::Position; use super::space::Shape; use super::space::Space; use super::space_db::SpaceDB; -use super::space_index::SpaceFields; use super::space_index::SpaceSetObject; use super::DataBase; use super::ResultSet; -use crate::SpaceObject; pub struct CoreQueryParameters<'a> { pub db: &'a DataBase, @@ -67,16 +65,6 @@ impl Properties { } } -// FIXME: Which is faster, the code below or the automatically generated -// implementation? -/* -impl PartialEq for Properties { - fn eq(&self, other: &Self) -> bool { - self.id() == other.id() && self.type_name() == other.type_name() - } -} -*/ - #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Core { title: String, @@ -159,24 +147,6 @@ impl Core { &self.properties } - fn to_space_object( - &self, - space_id: &str, - list: Vec<(Position, SpaceFields)>, - ) -> Vec { - list.into_iter() - .map(|(position, fields)| { - let offset: usize = fields.value().into(); - let value = self.properties[offset].clone(); - SpaceObject { - space_id: space_id.to_string(), - position: position.clone(), - value, - } - }) - .collect() - } - fn decode_positions( list: &mut [(Position, &Properties)], space: &Space, @@ -430,9 +400,3 @@ impl Core { Ok(results) } } - -impl ironsea_index::Record for Core { - fn key(&self) -> String { - self.title.clone() - } -} diff --git a/src/database/mod.rs b/src/database/mod.rs index 459f40e..fdad9c7 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -29,7 +29,6 @@ pub struct SpaceObject { pub value: Properties, } -#[derive(Clone, Debug, Deserialize, Serialize)] pub struct DataBase { reference_spaces: ReferenceSpaceIndex, cores: CoreIndex, @@ -85,7 +84,7 @@ impl DataBase { } } - pub fn load_core(name: &str) -> Result<(Vec, Core), String> { + fn load_core(name: &str) -> Result<(Vec, Core), String> { let mmap = DataBase::mmap_file(&name)?; match bincode::deserialize(&mmap[..]) { @@ -181,3 +180,9 @@ impl ironsea_index::Record for Space { self.name().clone() } } + +impl ironsea_index::Record for Core { + fn key(&self) -> String { + self.name().clone() + } +}