1use crate::{
2 TreeVariant,
3 aliases::Col,
4 memory::{Auto, MemoryPolicy},
5 node_ref::NodeRefCore,
6 pinned_storage::{PinnedStorage, SplitRecursive},
7};
8use orx_selfref_col::NodePtr;
9
10pub struct Node<'a, V, M = Auto, P = SplitRecursive>
12where
13 V: TreeVariant,
14 M: MemoryPolicy,
15 P: PinnedStorage,
16{
17 col: &'a Col<V, M, P>,
18 node_ptr: NodePtr<V>,
19}
20
21impl<V, M, P> Clone for Node<'_, V, M, P>
22where
23 V: TreeVariant,
24 M: MemoryPolicy,
25 P: PinnedStorage,
26{
27 fn clone(&self) -> Self {
28 Self {
29 col: self.col,
30 node_ptr: self.node_ptr.clone(),
31 }
32 }
33}
34
35impl<'a, V, M, P> Node<'a, V, M, P>
36where
37 V: TreeVariant,
38 M: MemoryPolicy,
39 P: PinnedStorage,
40{
41 pub(crate) fn new(col: &'a Col<V, M, P>, node_ptr: NodePtr<V>) -> Self {
44 Self { col, node_ptr }
45 }
46}
47
48impl<'a, V, M, P> NodeRefCore<'a, V, M, P> for Node<'a, V, M, P>
49where
50 V: TreeVariant,
51 M: MemoryPolicy,
52 P: PinnedStorage,
53{
54 #[inline(always)]
55 fn col(&self) -> &Col<V, M, P> {
56 self.col
57 }
58
59 #[inline(always)]
60 fn node_ptr(&self) -> &NodePtr<V> {
61 &self.node_ptr
62 }
63}