@@ -4,7 +4,7 @@ use snapshot_vec as sv;
44use std:: marker:: PhantomData ;
55use std:: ops:: { self , Range } ;
66
7- use undo_log:: { Rollback , Snapshots , UndoLogs , VecLog } ;
7+ use undo_log:: { Rollback , Snapshots , VecLog } ;
88
99use super :: { UnifyKey , UnifyValue , VarValue } ;
1010
@@ -19,18 +19,8 @@ pub trait UnificationStoreBase: ops::Index<usize, Output = VarValue<Key<Self>>>
1919 type Key : UnifyKey < Value = Self :: Value > ;
2020 type Value : UnifyValue ;
2121
22- fn reset_unifications ( & mut self , value : impl FnMut ( u32 ) -> VarValue < Self :: Key > ) ;
23-
2422 fn len ( & self ) -> usize ;
2523
26- fn push ( & mut self , value : VarValue < Self :: Key > ) ;
27-
28- fn reserve ( & mut self , num_new_values : usize ) ;
29-
30- fn update < F > ( & mut self , index : usize , op : F )
31- where
32- F : FnOnce ( & mut VarValue < Self :: Key > ) ;
33-
3424 fn tag ( ) -> & ' static str {
3525 Self :: Key :: tag ( )
3626 }
@@ -39,6 +29,16 @@ pub trait UnificationStoreBase: ops::Index<usize, Output = VarValue<Key<Self>>>
3929pub trait UnificationStore : UnificationStoreBase {
4030 type Snapshot ;
4131
32+ fn reset_unifications ( & mut self , value : impl FnMut ( u32 ) -> VarValue < Self :: Key > ) ;
33+
34+ fn push ( & mut self , value : VarValue < Self :: Key > ) ;
35+
36+ fn reserve ( & mut self , num_new_values : usize ) ;
37+
38+ fn update < F > ( & mut self , index : usize , op : F )
39+ where
40+ F : FnOnce ( & mut VarValue < Self :: Key > ) ;
41+
4242 fn start_snapshot ( & mut self ) -> Self :: Snapshot ;
4343
4444 fn rollback_to ( & mut self , snapshot : Self :: Snapshot ) ;
@@ -72,20 +72,28 @@ impl<K, V, L> UnificationStoreBase for InPlace<K, V, L>
7272where
7373 K : UnifyKey ,
7474 V : sv:: VecLike < Delegate < K > > ,
75- L : UndoLogs < sv:: UndoLog < Delegate < K > > > ,
7675{
7776 type Key = K ;
7877 type Value = K :: Value ;
7978
79+ fn len ( & self ) -> usize {
80+ self . values . len ( )
81+ }
82+ }
83+
84+ impl < K , V , L > UnificationStore for InPlace < K , V , L >
85+ where
86+ K : UnifyKey ,
87+ V : sv:: VecLike < Delegate < K > > ,
88+ L : Snapshots < sv:: UndoLog < Delegate < K > > > ,
89+ {
90+ type Snapshot = sv:: Snapshot < L :: Snapshot > ;
91+
8092 #[ inline]
8193 fn reset_unifications ( & mut self , mut value : impl FnMut ( u32 ) -> VarValue < Self :: Key > ) {
8294 self . values . set_all ( |i| value ( i as u32 ) ) ;
8395 }
8496
85- fn len ( & self ) -> usize {
86- self . values . len ( )
87- }
88-
8997 #[ inline]
9098 fn push ( & mut self , value : VarValue < Self :: Key > ) {
9199 self . values . push ( value) ;
@@ -103,15 +111,6 @@ where
103111 {
104112 self . values . update ( index, op)
105113 }
106- }
107-
108- impl < K , V , L > UnificationStore for InPlace < K , V , L >
109- where
110- K : UnifyKey ,
111- V : sv:: VecLike < Delegate < K > > ,
112- L : Snapshots < sv:: UndoLog < Delegate < K > > > ,
113- {
114- type Snapshot = sv:: Snapshot < L :: Snapshot > ;
115114
116115 #[ inline]
117116 fn start_snapshot ( & mut self ) -> Self :: Snapshot {
0 commit comments