aboutsummaryrefslogtreecommitdiff
path: root/src/data/arena.rs
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2021-01-29 14:42:32 +0100
committerGitHub <noreply@github.com>2021-01-29 14:42:32 +0100
commit7ca46f38cde6cf8bf8bf41ea6067ae5bc938205c (patch)
tree3781b9d7c92a6a8111573ba4cae1c5d41435950e /src/data/arena.rs
parente6fc8f67faf3e37afe38d683cbd930d457f289be (diff)
parent825f33efaec4ce6a8903751e836a0ea9c466ff92 (diff)
downloadrapier-7ca46f38cde6cf8bf8bf41ea6067ae5bc938205c.tar.gz
rapier-7ca46f38cde6cf8bf8bf41ea6067ae5bc938205c.tar.bz2
rapier-7ca46f38cde6cf8bf8bf41ea6067ae5bc938205c.zip
Merge pull request #79 from dimforge/split_geom
Move most of the geometric code to another crate.
Diffstat (limited to 'src/data/arena.rs')
-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..9d057b8 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 parry::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.
///