diff --git a/Cargo.toml b/Cargo.toml index 9cb8778..2951f2c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ homepage = "https://zenyx-engine.github.io/" repository = "https://codeberg.org/Caznix/Zenyx" [lib] -crate-type = ["cdylib"] +# crate-type = ["cdylib"] [workspace] resolver = "2" diff --git a/src/collections/sparse_set.rs b/src/collections/sparse_set.rs index fd31b88..2bbcc7e 100644 --- a/src/collections/sparse_set.rs +++ b/src/collections/sparse_set.rs @@ -15,13 +15,13 @@ type SparsePage = Option<(Box<[Option; SPARSE_PAGESIZE], A>, us /// The sparse allocator is mainly used for bulk allocations in the system's page size /// for the lookup array. It will also be used for the array of pointers into those /// bulk allocations. Additionally it will be used for the reverse map that generates keys -/// from the value in the internal packed array +/// from the value in the internal packed array. /// /// The packed allocator will exclusively be used to store the values of type `T`. /// /// All operations on this datastructure, meaning insertion, lookup, and deletion, are `O(1)`. /// -/// This datastructure does not in any way guarantee ordering of the values on +/// This data structure does not in any way guarantee ordering of the values on /// its own. #[derive(Hash)] pub struct SparseSet @@ -32,9 +32,9 @@ where /// The paginated array of keys. The value at the key is an index into the dense array minus /// one where the value corresponding to that key is stored. sparse: Vec, SparseAlloc>, - /// The dense array where the values corresponding to the keys are stored + /// The dense array where the values corresponding to the keys are stored. dense: Vec, - /// The reverse map to get the index in the sparse array from the index in the dense array + /// The reverse map to get the index in the sparse array from the index in the dense array. dense_to_id: Vec, } @@ -105,7 +105,7 @@ where } } - /// Gets the value with the key `id` + /// Gets the value with the key `id`. /// /// ``` /// use zenyx::collections::SparseSet; @@ -161,7 +161,7 @@ where } } - /// Gets the index in the dense array for a key `id` + /// Gets the index in the dense array for a key `id`. /// /// ``` /// use zenyx::collections::SparseSet; @@ -178,7 +178,7 @@ where } /// This reduces the usage count for a page in the sparse array, deallocating - /// it if it is not used anymore + /// it if it is not used anymore. fn reduce_page_usage_count(&mut self, id: usize) { let page = id / SPARSE_PAGESIZE; let Some(usage) = &mut self.sparse[page] else { @@ -191,7 +191,7 @@ where } } - /// Increase the page usage count for a page in the sparse array + /// Increase the page usage count for a page in the sparse array. fn increase_page_usage_count(&mut self, id: usize) { let page = id / SPARSE_PAGESIZE; if page >= self.sparse.len() { @@ -243,7 +243,7 @@ where self.len() == 0 } - /// Returns the number of values in this sparse set + /// Returns the number of values in this sparse set. /// /// ``` /// use zenyx::collections::SparseSet; @@ -258,7 +258,7 @@ where self.dense.len() } - /// Checks if the sparse set contains a value with key `id` + /// Checks if the sparse set contains a value with key `id`. /// /// ``` /// use zenyx::collections::SparseSet; @@ -315,7 +315,7 @@ where &self.dense } - /// Mutable version of [`Self::keys`] + /// Mutable version of [`Self::keys`]. /// /// ``` /// use zenyx::collections::SparseSet;