Skip to main content

dope_sys/table/
raw.rs

1use std::os::fd;
2
3use crate::table::change;
4
5/// # Safety
6/// Layout yields `(capacity, accepted_prefix)`; the prefix fits capacity. Owned conversion preserves identity.
7/// Accepted conversion succeeds only in its prefix and stays affine; `excludes` reports indices outside capacity.
8pub unsafe trait Slots: change::raw::Slots {
9    type Layout: Copy + Into<(Self::Capacity, Self::Capacity)>;
10    type Owned: Copy + Into<Self::Physical>;
11    type Accepted: TryFrom<(Self::Index, Self::Capacity)>;
12    type Missing: Copy + Eq;
13
14    fn excludes(capacity: Self::Capacity, index: Self::Index) -> Option<Self::Missing>;
15    fn backing(index: Self::Index) -> Self::Missing;
16    fn vacant(index: Self::Index) -> Self::Missing;
17    fn replaced(index: Self::Index, expected: fd::RawFd, actual: fd::RawFd) -> Self::Missing;
18}