Add prelude + use vectors for setting linvel/translation in builders

This commit is contained in:
Crozet Sébastien
2021-05-25 11:00:13 +02:00
parent 47139323e0
commit 1bef66fea9
93 changed files with 1528 additions and 1259 deletions

View File

@@ -13,6 +13,14 @@ impl<T> Coarena<T> {
Self { data: Vec::new() }
}
/// Gets a specific element from the coarena without specifying its generation number.
///
/// It is strongly encouraged to use `Coarena::get` instead of this method because this method
/// can suffer from the ABA problem.
pub fn get_unknown_gen(&self, index: u32) -> Option<&T> {
self.data.get(index as usize).map(|(_, t)| t)
}
/// Gets a specific element from the coarena, if it exists.
pub fn get(&self, index: Index) -> Option<&T> {
let (i, g) = index.into_raw_parts();