@@ -134,7 +134,7 @@ where
134
134
/// the cycle detectors themselves can be small and cheaply cloned.
135
135
pub struct Appendables < H > {
136
136
/// List arena for appendable lists
137
- elements : ListArena < InternedPathOrHandle < H > > ,
137
+ elements : ListArena < InternedOrHandle < H > > ,
138
138
/// Arena for interned partial paths
139
139
interned : Arena < PartialPath > ,
140
140
}
@@ -148,13 +148,15 @@ impl<H> Appendables<H> {
148
148
}
149
149
}
150
150
151
+ /// Enum that unifies handles to initial paths interned in the cycle detector, and appended
152
+ /// handles to appendables in the external database.
151
153
#[ derive( Clone ) ]
152
- pub ( crate ) enum InternedPathOrHandle < H > {
153
- Owned ( Handle < PartialPath > ) ,
154
+ enum InternedOrHandle < H > {
155
+ Interned ( Handle < PartialPath > ) ,
154
156
Database ( H ) ,
155
157
}
156
158
157
- impl < H > InternedPathOrHandle < H >
159
+ impl < H > InternedOrHandle < H >
158
160
where
159
161
H : Clone ,
160
162
{
@@ -171,7 +173,7 @@ where
171
173
Db : ToAppendable < H , A > ,
172
174
{
173
175
match self {
174
- Self :: Owned ( h) => interned. get ( * h) . append_to ( graph, partials, path) ,
176
+ Self :: Interned ( h) => interned. get ( * h) . append_to ( graph, partials, path) ,
175
177
Self :: Database ( h) => db. get_appendable ( h) . append_to ( graph, partials, path) ,
176
178
}
177
179
}
@@ -182,7 +184,7 @@ where
182
184
Db : ToAppendable < H , A > ,
183
185
{
184
186
match self {
185
- Self :: Owned ( h) => interned. get ( * h) . start_node ,
187
+ Self :: Interned ( h) => interned. get ( * h) . start_node ,
186
188
Self :: Database ( h) => db. get_appendable ( h) . start_node ( ) ,
187
189
}
188
190
}
@@ -193,7 +195,7 @@ where
193
195
Db : ToAppendable < H , A > ,
194
196
{
195
197
match self {
196
- Self :: Owned ( h) => interned. get ( * h) . end_node ,
198
+ Self :: Interned ( h) => interned. get ( * h) . end_node ,
197
199
Self :: Database ( h) => db. get_appendable ( h) . end_node ( ) ,
198
200
}
199
201
}
@@ -205,7 +207,7 @@ where
205
207
/// cheap.
206
208
#[ derive( Clone ) ]
207
209
pub struct AppendingCycleDetector < H > {
208
- appendages : List < InternedPathOrHandle < H > > ,
210
+ appendages : List < InternedOrHandle < H > > ,
209
211
}
210
212
211
213
impl < H > AppendingCycleDetector < H > {
@@ -220,14 +222,14 @@ impl<H> AppendingCycleDetector<H> {
220
222
let mut result = Self :: new ( ) ;
221
223
result
222
224
. appendages
223
- . push_front ( & mut appendables. elements , InternedPathOrHandle :: Owned ( h) ) ;
225
+ . push_front ( & mut appendables. elements , InternedOrHandle :: Interned ( h) ) ;
224
226
result
225
227
}
226
228
227
229
pub fn append ( & mut self , appendables : & mut Appendables < H > , appendage : H ) {
228
230
self . appendages . push_front (
229
231
& mut appendables. elements ,
230
- InternedPathOrHandle :: Database ( appendage) ,
232
+ InternedOrHandle :: Database ( appendage) ,
231
233
) ;
232
234
}
233
235
}
0 commit comments