Skip to main content

dope_sys/table/permit/
queue.rs

1use o3::depot;
2
3use crate::table::permit;
4
5/// Generation-exact registration storage selected by the native backend.
6pub trait Queue: Sized {
7    type Key: permit::raw::Key;
8    type Index: depot::raw::Compact;
9    type Capability;
10
11    fn try_acquire() -> Result<Self::Capability, permit::Absent>;
12    fn try_arm(
13        &self,
14        permit: &Self::Capability,
15        index: Self::Index,
16        key: Self::Key,
17    ) -> Result<(), Self::Key>;
18    fn cancel(
19        &self,
20        permit: &Self::Capability,
21        index: Self::Index,
22        key: Self::Key,
23    ) -> permit::State<Self::Key>;
24    fn take(
25        &self,
26        permit: &Self::Capability,
27        index: Self::Index,
28        key: Self::Key,
29    ) -> permit::State<Self::Key>;
30    fn grant_one(&self, permit: &Self::Capability) -> Option<(Self::Index, Self::Key)>;
31}