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
use crate::{
    normalized_actions::NormalizedAction, ActionSplit, MergeInto, MergeIntoUnpadded, TreeBase,
    UnzipPadded,
};

impl<T: Sized + TreeBase<V>, V: NormalizedAction> TreeCollector<V> for T {}

/// All Collection functionality on the TreeIters
pub trait TreeCollector<V: NormalizedAction>: TreeBase<V> {
    fn split_actions<FromI, Fns>(self, filters: Fns) -> FromI
    where
        Self: Sized + ActionSplit<FromI, Fns, V>,
    {
        ActionSplit::action_split_impl(self, filters)
    }

    fn split_actions_ref<FromI, Fns>(self, filters: &Fns) -> FromI
    where
        Self: Sized + ActionSplit<FromI, Fns, V>,
    {
        ActionSplit::action_split_ref_impl(self, filters)
    }

    fn split_return_rem<FromI, Fns>(self, filters: Fns) -> (FromI, Vec<V>)
    where
        Self: Sized + ActionSplit<FromI, Fns, V>,
        FromI: IntoIterator,
    {
        ActionSplit::action_split_out_impl(self, filters)
    }

    fn split_return_ref_rem<FromI, Fns>(self, filters: &Fns) -> (FromI, Vec<V>)
    where
        Self: Sized + ActionSplit<FromI, Fns, V>,
        FromI: IntoIterator,
    {
        ActionSplit::action_split_out_ref_impl(self, filters)
    }

    fn unzip_padded<FromZ>(self) -> FromZ
    where
        Self: UnzipPadded<FromZ> + Sized,
    {
        UnzipPadded::unzip_padded(self)
    }

    fn merge_into<I, Ty>(self) -> I
    where
        Self: MergeInto<I, Ty, Self::Item> + Sized,
    {
        MergeInto::merge_into(self)
    }

    fn merge_into_unpadded<I, Ty>(self) -> I
    where
        Self: MergeIntoUnpadded<I, Ty, Self::Item> + Sized,
    {
        MergeIntoUnpadded::merge_into_unpadded(self)
    }
}