dope_sys/table/change/
changes.rs1use o3::alloc;
2
3use crate::{Budget, table::change};
4
5pub trait Changes: Sized {
6 type Slots: super::raw::Slots;
7 type Id: change::Id<Slot = <Self::Slots as super::raw::Slots>::Physical>;
8 type Read<'a>: change::Interest<Id = Self::Id, Data = <Self::Slots as super::raw::Slots>::Data>
9 where
10 Self: 'a;
11 type Write<'a>: change::Write
12 + change::Interest<Id = Self::Id, Data = <Self::Slots as super::raw::Slots>::Data>
13 where
14 Self: 'a;
15 type Tail<'a>: change::Tail
16 where
17 Self: 'a;
18 type Deletion<'a>: change::Delete
19 where
20 Self: 'a;
21
22 fn try_new(
23 capacity: <Self::Slots as super::raw::Slots>::Capacity,
24 ) -> Result<Self, alloc::Error>;
25 fn read(&mut self, id: Self::Id) -> Option<Self::Read<'_>>;
26 fn write(&mut self, id: Self::Id) -> Option<Self::Write<'_>>;
27 fn try_delete(
28 &mut self,
29 entries: impl Iterator<
30 Item = Result<
31 Option<(Self::Id, change::Filter)>,
32 change::Index<<Self::Slots as super::raw::Slots>::Index>,
33 >,
34 >,
35 ) -> Result<Self::Deletion<'_>, change::Index<<Self::Slots as super::raw::Slots>::Index>>;
36 fn is_empty(&self) -> bool;
37 fn len(&self) -> usize;
38 fn batch(&mut self, budget: &mut impl Budget) -> Self::Tail<'_>;
39 fn tail(&mut self, limit: usize) -> Self::Tail<'_>;
40}