aboutsummaryrefslogtreecommitdiff
path: root/src/data
diff options
context:
space:
mode:
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.
///