orx_tree/traversal/
node_item_mut.rs1use crate::TreeVariant;
2use crate::aliases::Col;
3use crate::memory::{Auto, MemoryPolicy};
4use crate::pinned_storage::{PinnedStorage, SplitRecursive};
5use orx_selfref_col::NodePtr;
6
7pub trait NodeItemMut<'a, V, M = Auto, P = SplitRecursive>
8where
9 V: TreeVariant,
10 M: MemoryPolicy,
11 P: PinnedStorage,
12{
13 fn from_ptr(col: &'a Col<V, M, P>, node_ptr: NodePtr<V>) -> Self;
14}
15
16impl<'a, V, M, P> NodeItemMut<'a, V, M, P> for &'a mut V::Item
17where
18 V: TreeVariant,
19 M: MemoryPolicy,
20 P: PinnedStorage,
21{
22 #[inline(always)]
23 fn from_ptr(_: &'a Col<V, M, P>, node_ptr: NodePtr<V>) -> Self {
24 let node = unsafe { &mut *node_ptr.ptr_mut() };
25 node.data_mut().expect("active tree node has data")
26 }
27}