Skip to content

Commit b1934a1

Browse files
author
Markus Westerlind
committed
refactor: Restrict with_log to the Storage types
Not strictly necessary, but it documents things better and may make some mistakes impossible
1 parent 9568b3b commit b1934a1

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

src/snapshot_vec.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,14 @@ impl<D: SnapshotVecDelegate, V: VecLike<D> + Default, L: Default> SnapshotVec<D,
163163
}
164164
}
165165

166-
impl<D: SnapshotVecDelegate, V: VecLike<D>, L> SnapshotVec<D, V, L> {
167-
/// Creates a `SnapshotVec` using the `undo_log`, allowing mutating methods to be
168-
/// called if `L` does not implement `UndoLogs`
169-
pub fn with_log<'a, L2>(&'a mut self, undo_log: L2) -> SnapshotVec<D, &'a mut V, L2>
166+
impl<D: SnapshotVecDelegate> SnapshotVecStorage<D> {
167+
/// Creates a `SnapshotVec` using the `undo_log`, allowing mutating methods to be called
168+
pub fn with_log<'a, L>(
169+
&'a mut self,
170+
undo_log: L,
171+
) -> SnapshotVec<D, &'a mut Vec<<D as SnapshotVecDelegate>::Value>, L>
170172
where
171-
L2: UndoLogs<UndoLog<D>>,
172-
&'a mut V: VecLike<D>,
173+
L: UndoLogs<UndoLog<D>>,
173174
{
174175
SnapshotVec {
175176
values: &mut self.values,

src/unify/mod.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,20 +243,18 @@ impl<K: UnifyKey> VarValue<K> {
243243
}
244244
}
245245
}
246-
impl<K, V, L> UnificationTable<InPlace<K, V, L>>
246+
impl<K> UnificationTableStorage<K>
247247
where
248248
K: UnifyKey,
249-
V: sv::VecLike<Delegate<K>>,
250249
{
251250
/// Creates a `UnificationTable` using an external `undo_log`, allowing mutating methods to be
252251
/// called if `L` does not implement `UndoLogs`
253-
pub fn with_log<'a, L2>(
252+
pub fn with_log<'a, L>(
254253
&'a mut self,
255-
undo_log: L2,
256-
) -> UnificationTable<InPlace<K, &'a mut V, L2>>
254+
undo_log: L,
255+
) -> UnificationTable<InPlace<K, &'a mut UnificationStorage<K>, L>>
257256
where
258-
L2: UndoLogs<sv::UndoLog<Delegate<K>>>,
259-
&'a mut V: sv::VecLike<Delegate<K>>,
257+
L: UndoLogs<sv::UndoLog<Delegate<K>>>,
260258
{
261259
UnificationTable {
262260
values: InPlace {

0 commit comments

Comments
 (0)