Skip to main content

orx_tree/dary/
variant.rs

1use super::reclaimer::DaryReclaimer;
2use crate::TreeVariant;
3use core::marker::PhantomData;
4use orx_selfref_col::{RefsArrayLeftMost, RefsSingle, Variant};
5
6/// A dynamic tree where each of the nodes might have any number of child nodes.
7pub struct Dary<const D: usize, T> {
8    p: PhantomData<T>,
9}
10
11/// # SAFETY
12///
13/// Tree variants do not hold any data; and hence, safe to sync.
14unsafe impl<const D: usize, T> Sync for Dary<D, T> {}
15
16/// # SAFETY
17///
18/// Tree variants do not hold any data; and hence, safe to sync.
19unsafe impl<const D: usize, T> Send for Dary<D, T> {}
20
21impl<const D: usize, T> Variant for Dary<D, T> {
22    type Item = T;
23
24    type Prev = RefsSingle<Self>;
25
26    type Next = RefsArrayLeftMost<D, Self>;
27
28    type Ends = RefsSingle<Self>;
29}
30
31impl<const D: usize, T> TreeVariant for Dary<D, T> {
32    type Reclaimer = DaryReclaimer;
33
34    type Children = RefsArrayLeftMost<D, Self>;
35}