aboutsummaryrefslogtreecommitdiff
path: root/src/data
diff options
context:
space:
mode:
authorCrozet Sébastien <developer@crozet.re>2020-12-14 15:51:43 +0100
committerCrozet Sébastien <developer@crozet.re>2020-12-29 11:31:00 +0100
commitcc6d1b973002b4d366bc81ec6bf9e8240ad7b404 (patch)
tree66827195ef82f22e545fc9ee4e0bade9baa8031b /src/data
parent9bf1321f8f1d2e116f44c2461a53f302c4ef4171 (diff)
downloadrapier-cc6d1b973002b4d366bc81ec6bf9e8240ad7b404.tar.gz
rapier-cc6d1b973002b4d366bc81ec6bf9e8240ad7b404.tar.bz2
rapier-cc6d1b973002b4d366bc81ec6bf9e8240ad7b404.zip
Outsource the Shape trait, wquadtree, and shape types.
Diffstat (limited to 'src/data')
-rw-r--r--src/data/arena.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/data/arena.rs b/src/data/arena.rs
index fcec017..a3af45c 100644
--- a/src/data/arena.rs
+++ b/src/data/arena.rs
@@ -3,6 +3,7 @@
//! See https://github.com/fitzgen/generational-arena/blob/master/src/lib.rs.
//! This has been modified to have a fully deterministic deserialization (including for the order of
//! Index attribution after a deserialization of the arena.
+use buckler::partitioning::IndexedData;
use std::cmp;
use std::iter::{self, Extend, FromIterator, FusedIterator};
use std::mem;
@@ -51,6 +52,16 @@ pub struct Index {
generation: u64,
}
+impl IndexedData for Index {
+ fn default() -> Self {
+ Self::from_raw_parts(crate::INVALID_USIZE, crate::INVALID_U64)
+ }
+
+ fn index(&self) -> usize {
+ self.into_raw_parts().0
+ }
+}
+
impl Index {
/// Create a new `Index` from its raw parts.
///