orx_tree/subtrees_within/
subtree_within.rs

1use crate::TreeVariant;
2
3pub(crate) mod sealed {
4    use crate::{
5        MemoryPolicy, NodeIdx, NodeMut, NodeMutOrientation, TreeVariant,
6        pinned_storage::PinnedStorage,
7    };
8
9    pub trait SubTreeWithinCore<V: TreeVariant>: Sized {
10        fn append_to_node_within_as_child<M, P, MO>(
11            self,
12            parent: &mut NodeMut<V, M, P, MO>,
13            child_position: usize,
14        ) -> NodeIdx<V>
15        where
16            M: MemoryPolicy,
17            P: PinnedStorage,
18            MO: NodeMutOrientation;
19    }
20}
21
22/// A subtree is a subset of a tree, also having a single root and satisfying structural tree properties.
23///
24/// SubTreeWithin implementations are used to efficiently and conveniently move parts of the tree within itself.
25pub trait SubTreeWithin<V: TreeVariant>: sealed::SubTreeWithinCore<V> {}
26
27impl<V: TreeVariant, S: sealed::SubTreeWithinCore<V>> SubTreeWithin<V> for S {}