diff --git a/src/protocol/arena.rs b/src/protocol/arena.rs index ad5356c82fc4dcb769f1205b58a61bb81ef69c16..2120f5d9b983c1af93ba6530e5a6565e15d101eb 100644 --- a/src/protocol/arena.rs +++ b/src/protocol/arena.rs @@ -4,7 +4,7 @@ use core::marker::PhantomData; #[derive(serde::Serialize, serde::Deserialize)] pub struct Id { - index: u32, + pub(crate) index: u32, _phantom: PhantomData, } #[derive(Debug, serde::Serialize, serde::Deserialize)] @@ -35,6 +35,7 @@ impl Hash for Id { self.index.hash(h); } } + impl Arena { pub fn new() -> Self { Self { store: vec![] } @@ -48,8 +49,8 @@ impl Arena { self.store.push(f(id)); id } - pub fn iter(&self) -> impl Iterator, &T)> { - (0..).map(|index| Id { index, _phantom: Default::default() }).zip(self.store.iter()) + pub fn iter(&self) -> impl Iterator { + self.store.iter() } } impl core::ops::Index> for Arena { @@ -62,4 +63,4 @@ impl core::ops::IndexMut> for Arena { fn index_mut(&mut self, id: Id) -> &mut Self::Output { self.store.index_mut(id.index as usize) } -} +} \ No newline at end of file