@@ -4,7 +4,7 @@ use snapshot_vec as sv;
4
4
use std:: marker:: PhantomData ;
5
5
use std:: ops:: { self , Range } ;
6
6
7
- use undo_log:: { Rollback , Snapshots , UndoLogs , VecLog } ;
7
+ use undo_log:: { Rollback , Snapshots , VecLog } ;
8
8
9
9
use super :: { UnifyKey , UnifyValue , VarValue } ;
10
10
@@ -19,18 +19,8 @@ pub trait UnificationStoreBase: ops::Index<usize, Output = VarValue<Key<Self>>>
19
19
type Key : UnifyKey < Value = Self :: Value > ;
20
20
type Value : UnifyValue ;
21
21
22
- fn reset_unifications ( & mut self , value : impl FnMut ( u32 ) -> VarValue < Self :: Key > ) ;
23
-
24
22
fn len ( & self ) -> usize ;
25
23
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
-
34
24
fn tag ( ) -> & ' static str {
35
25
Self :: Key :: tag ( )
36
26
}
@@ -39,6 +29,16 @@ pub trait UnificationStoreBase: ops::Index<usize, Output = VarValue<Key<Self>>>
39
29
pub trait UnificationStore : UnificationStoreBase {
40
30
type Snapshot ;
41
31
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
+
42
42
fn start_snapshot ( & mut self ) -> Self :: Snapshot ;
43
43
44
44
fn rollback_to ( & mut self , snapshot : Self :: Snapshot ) ;
@@ -72,20 +72,28 @@ impl<K, V, L> UnificationStoreBase for InPlace<K, V, L>
72
72
where
73
73
K : UnifyKey ,
74
74
V : sv:: VecLike < Delegate < K > > ,
75
- L : UndoLogs < sv:: UndoLog < Delegate < K > > > ,
76
75
{
77
76
type Key = K ;
78
77
type Value = K :: Value ;
79
78
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
+
80
92
#[ inline]
81
93
fn reset_unifications ( & mut self , mut value : impl FnMut ( u32 ) -> VarValue < Self :: Key > ) {
82
94
self . values . set_all ( |i| value ( i as u32 ) ) ;
83
95
}
84
96
85
- fn len ( & self ) -> usize {
86
- self . values . len ( )
87
- }
88
-
89
97
#[ inline]
90
98
fn push ( & mut self , value : VarValue < Self :: Key > ) {
91
99
self . values . push ( value) ;
@@ -103,15 +111,6 @@ where
103
111
{
104
112
self . values . update ( index, op)
105
113
}
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 > ;
115
114
116
115
#[ inline]
117
116
fn start_snapshot ( & mut self ) -> Self :: Snapshot {
0 commit comments