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