bitstring_trees/tree/mut_owned/
iter.rs1use crate::tree::{
2 mut_gen,
3 TreeProperties,
4 WalkedDirection,
5};
6
7pub struct IterWalkMutOwnedPath<'r, 'w, TP, D = ()>
11where
12 TP: TreeProperties + 'r,
13{
14 inner: mut_gen::IterWalkMutPath<'r, 'w, TP, mut_gen::Owned, D>,
15}
16
17impl<'r, TP, D> Iterator for IterWalkMutOwnedPath<'r, '_, TP, D>
18where
19 TP: TreeProperties + 'r,
20 D: From<WalkedDirection>,
21{
22 type Item = (
23 &'r TP::Key,
24 &'r mut TP::Value,
25 Option<&'r mut TP::LeafValue>,
26 );
27
28 fn next(&mut self) -> Option<Self::Item> {
29 self.inner.next()
30 }
31}
32
33pub struct IterMutOwnedPreOrder<'r, TP>
35where
36 TP: TreeProperties + 'r,
37{
38 inner: mut_gen::IterMutPreOrder<'r, TP, mut_gen::Owned>,
39}
40
41impl<'r, TP> From<mut_gen::IterMutPreOrder<'r, TP, mut_gen::Owned>> for IterMutOwnedPreOrder<'r, TP>
42where
43 TP: TreeProperties + 'r,
44{
45 fn from(inner: mut_gen::IterMutPreOrder<'r, TP, mut_gen::Owned>) -> Self {
46 Self { inner }
47 }
48}
49
50impl<'r, TP> Iterator for IterMutOwnedPreOrder<'r, TP>
51where
52 TP: TreeProperties + 'r,
53{
54 type Item = (
55 &'r TP::Key,
56 &'r mut TP::Value,
57 Option<&'r mut TP::LeafValue>,
58 );
59
60 fn next(&mut self) -> Option<Self::Item> {
61 self.inner.next()
62 }
63}
64
65pub struct IterMutOwnedInOrder<'r, TP>
67where
68 TP: TreeProperties + 'r,
69{
70 inner: mut_gen::IterMutInOrder<'r, TP, mut_gen::Owned>,
71}
72
73impl<'r, TP> From<mut_gen::IterMutInOrder<'r, TP, mut_gen::Owned>> for IterMutOwnedInOrder<'r, TP>
74where
75 TP: TreeProperties + 'r,
76{
77 fn from(inner: mut_gen::IterMutInOrder<'r, TP, mut_gen::Owned>) -> Self {
78 Self { inner }
79 }
80}
81
82impl<'r, TP> Iterator for IterMutOwnedInOrder<'r, TP>
83where
84 TP: TreeProperties + 'r,
85{
86 type Item = (
87 &'r TP::Key,
88 &'r mut TP::Value,
89 Option<&'r mut TP::LeafValue>,
90 );
91
92 fn next(&mut self) -> Option<Self::Item> {
93 self.inner.next()
94 }
95}
96
97pub struct IterMutOwnedPostOrder<'r, TP>
99where
100 TP: TreeProperties + 'r,
101{
102 inner: mut_gen::IterMutPostOrder<'r, TP, mut_gen::Owned>,
103}
104
105impl<'r, TP> From<mut_gen::IterMutPostOrder<'r, TP, mut_gen::Owned>>
106 for IterMutOwnedPostOrder<'r, TP>
107where
108 TP: TreeProperties + 'r,
109{
110 fn from(inner: mut_gen::IterMutPostOrder<'r, TP, mut_gen::Owned>) -> Self {
111 Self { inner }
112 }
113}
114
115impl<'r, TP> Iterator for IterMutOwnedPostOrder<'r, TP>
116where
117 TP: TreeProperties + 'r,
118{
119 type Item = (
120 &'r TP::Key,
121 &'r mut TP::Value,
122 Option<&'r mut TP::LeafValue>,
123 );
124
125 fn next(&mut self) -> Option<Self::Item> {
126 self.inner.next()
127 }
128}
129
130pub struct IterMutOwnedLeaf<'r, TP>
132where
133 TP: TreeProperties + 'r,
134{
135 inner: mut_gen::IterMutLeaf<'r, TP, mut_gen::Owned>,
136}
137
138impl<'r, TP> From<mut_gen::IterMutLeaf<'r, TP, mut_gen::Owned>> for IterMutOwnedLeaf<'r, TP>
139where
140 TP: TreeProperties + 'r,
141{
142 fn from(inner: mut_gen::IterMutLeaf<'r, TP, mut_gen::Owned>) -> Self {
143 Self { inner }
144 }
145}
146
147impl<'r, TP> Iterator for IterMutOwnedLeaf<'r, TP>
148where
149 TP: TreeProperties + 'r,
150{
151 type Item = (&'r TP::Key, &'r mut TP::LeafValue);
152
153 fn next(&mut self) -> Option<Self::Item> {
154 self.inner.next()
155 }
156}
157
158pub struct IterMutOwnedLeafFull<'r, TP>
160where
161 TP: TreeProperties + 'r,
162{
163 inner: mut_gen::IterMutLeafFull<'r, TP, mut_gen::Owned>,
164}
165
166impl<'r, TP> From<mut_gen::IterMutLeafFull<'r, TP, mut_gen::Owned>> for IterMutOwnedLeafFull<'r, TP>
167where
168 TP: TreeProperties + 'r,
169{
170 fn from(inner: mut_gen::IterMutLeafFull<'r, TP, mut_gen::Owned>) -> Self {
171 Self { inner }
172 }
173}
174
175impl<'r, TP> Iterator for IterMutOwnedLeafFull<'r, TP>
176where
177 TP: TreeProperties + 'r,
178{
179 type Item = (TP::Key, Option<&'r mut TP::LeafValue>);
180
181 fn next(&mut self) -> Option<Self::Item> {
182 self.inner.next()
183 }
184}