Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit e11f004

Browse files
author
Hendrik van Antwerpen
committed
Rename InternedPathOrHandle to InternedOrHandle
1 parent e6fd1a9 commit e11f004

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

stack-graphs/src/cycles.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ where
134134
/// the cycle detectors themselves can be small and cheaply cloned.
135135
pub struct Appendables<H> {
136136
/// List arena for appendable lists
137-
elements: ListArena<InternedPathOrHandle<H>>,
137+
elements: ListArena<InternedOrHandle<H>>,
138138
/// Arena for interned partial paths
139139
interned: Arena<PartialPath>,
140140
}
@@ -148,13 +148,15 @@ impl<H> Appendables<H> {
148148
}
149149
}
150150

151+
/// Enum that unifies handles to initial paths interned in the cycle detector, and appended
152+
/// handles to appendables in the external database.
151153
#[derive(Clone)]
152-
pub(crate) enum InternedPathOrHandle<H> {
153-
Owned(Handle<PartialPath>),
154+
enum InternedOrHandle<H> {
155+
Interned(Handle<PartialPath>),
154156
Database(H),
155157
}
156158

157-
impl<H> InternedPathOrHandle<H>
159+
impl<H> InternedOrHandle<H>
158160
where
159161
H: Clone,
160162
{
@@ -171,7 +173,7 @@ where
171173
Db: ToAppendable<H, A>,
172174
{
173175
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),
175177
Self::Database(h) => db.get_appendable(h).append_to(graph, partials, path),
176178
}
177179
}
@@ -182,7 +184,7 @@ where
182184
Db: ToAppendable<H, A>,
183185
{
184186
match self {
185-
Self::Owned(h) => interned.get(*h).start_node,
187+
Self::Interned(h) => interned.get(*h).start_node,
186188
Self::Database(h) => db.get_appendable(h).start_node(),
187189
}
188190
}
@@ -193,7 +195,7 @@ where
193195
Db: ToAppendable<H, A>,
194196
{
195197
match self {
196-
Self::Owned(h) => interned.get(*h).end_node,
198+
Self::Interned(h) => interned.get(*h).end_node,
197199
Self::Database(h) => db.get_appendable(h).end_node(),
198200
}
199201
}
@@ -205,7 +207,7 @@ where
205207
/// cheap.
206208
#[derive(Clone)]
207209
pub struct AppendingCycleDetector<H> {
208-
appendages: List<InternedPathOrHandle<H>>,
210+
appendages: List<InternedOrHandle<H>>,
209211
}
210212

211213
impl<H> AppendingCycleDetector<H> {
@@ -220,14 +222,14 @@ impl<H> AppendingCycleDetector<H> {
220222
let mut result = Self::new();
221223
result
222224
.appendages
223-
.push_front(&mut appendables.elements, InternedPathOrHandle::Owned(h));
225+
.push_front(&mut appendables.elements, InternedOrHandle::Interned(h));
224226
result
225227
}
226228

227229
pub fn append(&mut self, appendables: &mut Appendables<H>, appendage: H) {
228230
self.appendages.push_front(
229231
&mut appendables.elements,
230-
InternedPathOrHandle::Database(appendage),
232+
InternedOrHandle::Database(appendage),
231233
);
232234
}
233235
}

0 commit comments

Comments
 (0)