tola_caps/trie/
node.rs

1//! Trie node types: Empty, Leaf, Node16
2//!
3//! These are the core data structures for the 16-ary capability trie.
4
5use core::marker::PhantomData;
6
7/// Empty trie node (no capabilities)
8#[derive(Default)]
9pub struct Empty;
10
11/// Leaf node containing a single capability
12pub struct Leaf<Cap>(PhantomData<Cap>);
13
14// Manual Default impl: doesn't require Cap: Default
15impl<Cap> Default for Leaf<Cap> {
16    fn default() -> Self { Leaf(PhantomData) }
17}
18
19/// 16-ary internal node - one slot per nibble (0x0..0xF)
20#[allow(clippy::type_complexity)]
21#[macros::node16]
22pub struct Node16<_Slots_>(PhantomData<(_Slots_,)>);
23
24#[macros::node16]
25impl<_Slots_> Default for _Node16_ {
26    fn default() -> Self { Self(PhantomData) }
27}
28
29/// Type alias for an empty 16-ary node (all slots are Empty)
30#[macros::node16(all_empty)]
31pub type EmptyNode16;
32
33/// Bucket node for storing hash collisions (linear list)
34pub struct Bucket<Head, Tail>(PhantomData<(Head, Tail)>);
35
36impl<Head, Tail> Default for Bucket<Head, Tail> {
37    fn default() -> Self { Self(PhantomData) }
38}