orx_tree/traversal/
over_mut.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
use super::{
    enumeration::Enumeration,
    node_item_mut::NodeItemMut,
    over::{Over, OverData, OverDepthData, OverDepthSiblingIdxData, OverSiblingIdxData},
};
use crate::{
    memory::{Auto, MemoryPolicy},
    pinned_storage::{PinnedStorage, SplitRecursive},
    TreeVariant,
};
use orx_selfref_col::Variant;

pub type OverItemMut<'a, V, O, M = Auto, P = SplitRecursive> =
    <<O as Over>::Enumeration as Enumeration>::Item<<O as OverMut>::NodeItemMut<'a, V, M, P>>;

pub type OverItemInto<'a, V, O> =
    <<O as Over>::Enumeration as Enumeration>::Item<<V as Variant>::Item>;

/// Type that defines the type of the mutable items that iterators created by a traverser such as the [`Dfs`] or [`PostOrder`].
///
/// [`Dfs`]: crate::traversal::Dfs
/// [`PostOrder`]: crate::traversal::PostOrder
pub trait OverMut: Over {
    /// Part of the mutable iterator item which only depends on the node's internal data.
    type NodeItemMut<'a, V, M, P>: NodeItemMut<'a, V, M, P>
    where
        M: MemoryPolicy,
        P: PinnedStorage,
        V: TreeVariant + 'a,
        Self: 'a;
}

// val

impl OverMut for OverData {
    type NodeItemMut<'a, V, M, P>
        = &'a mut V::Item
    where
        M: MemoryPolicy,
        P: PinnedStorage,
        V: TreeVariant + 'a,
        Self: 'a;
}

// depth & val

impl OverMut for OverDepthData {
    type NodeItemMut<'a, V, M, P>
        = &'a mut V::Item
    where
        M: MemoryPolicy,
        P: PinnedStorage,
        V: TreeVariant + 'a,
        Self: 'a;
}

// sibling & val

impl OverMut for OverSiblingIdxData {
    type NodeItemMut<'a, V, M, P>
        = &'a mut V::Item
    where
        M: MemoryPolicy,
        P: PinnedStorage,
        V: TreeVariant + 'a,
        Self: 'a;
}

// depth & sibling & val

impl OverMut for OverDepthSiblingIdxData {
    type NodeItemMut<'a, V, M, P>
        = &'a mut V::Item
    where
        M: MemoryPolicy,
        P: PinnedStorage,
        V: TreeVariant + 'a,
        Self: 'a;
}