chore: fix missing periods
Some checks failed
Build Zenyx ⚡ / 🧪 Run Cargo Tests (push) Has been cancelled
Build Zenyx ⚡ / 🧪 Run Cargo Tests (pull_request) Successful in 6m53s
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (pull_request) Successful in 7m32s
Build Zenyx ⚡ / 🏗️ Build aarch64-pc-windows-msvc (pull_request) Successful in 8m14s
Build Zenyx ⚡ / 🏗️ Build x86_64-pc-windows-msvc (pull_request) Successful in 7m37s
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (pull_request) Successful in 7m40s

This commit is contained in:
BitSyndicate 2025-05-05 00:45:10 +02:00
parent c32f8126e9
commit 2704efbd9b
Signed by: bitsyndicate
GPG key ID: 443E4198D6BBA6DE

View file

@ -15,13 +15,13 @@ type SparsePage<A> = Option<(Box<[Option<NonZeroUsize>; 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<T, PackedAlloc = Global, SparseAlloc = Global>
@ -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<SparsePage<SparseAlloc>, 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<T, PackedAlloc>,
/// 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<usize, SparseAlloc>,
}
@ -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;