@@ -34,12 +34,16 @@ pub static INCREMENTAL_CACHE_DB: CacheDBConfiguration = CacheDBConfiguration {
3434pub struct IncrementalCache ( IncrementalCacheInner ) ;
3535
3636impl IncrementalCache {
37- pub fn new < TState : std :: hash :: Hash > (
37+ pub fn new (
3838 db : CacheDB ,
39- state : & TState ,
39+ state_hash : CacheDBHash ,
4040 initial_file_paths : & [ PathBuf ] ,
4141 ) -> Self {
42- IncrementalCache ( IncrementalCacheInner :: new ( db, state, initial_file_paths) )
42+ IncrementalCache ( IncrementalCacheInner :: new (
43+ db,
44+ state_hash,
45+ initial_file_paths,
46+ ) )
4347 }
4448
4549 pub fn is_file_same ( & self , file_path : & Path , file_text : & str ) -> bool {
@@ -67,12 +71,11 @@ struct IncrementalCacheInner {
6771}
6872
6973impl IncrementalCacheInner {
70- pub fn new < TState : std :: hash :: Hash > (
74+ pub fn new (
7175 db : CacheDB ,
72- state : & TState ,
76+ state_hash : CacheDBHash ,
7377 initial_file_paths : & [ PathBuf ] ,
7478 ) -> Self {
75- let state_hash = CacheDBHash :: from_source ( state) ;
7679 let sql_cache = SqlIncrementalCache :: new ( db, state_hash) ;
7780 Self :: from_sql_incremental_cache ( sql_cache, initial_file_paths)
7881 }
@@ -112,13 +115,13 @@ impl IncrementalCacheInner {
112115
113116 pub fn is_file_same ( & self , file_path : & Path , file_text : & str ) -> bool {
114117 match self . previous_hashes . get ( file_path) {
115- Some ( hash) => * hash == CacheDBHash :: from_source ( file_text) ,
118+ Some ( hash) => * hash == CacheDBHash :: from_hashable ( file_text) ,
116119 None => false ,
117120 }
118121 }
119122
120123 pub fn update_file ( & self , file_path : & Path , file_text : & str ) {
121- let hash = CacheDBHash :: from_source ( file_text) ;
124+ let hash = CacheDBHash :: from_hashable ( file_text) ;
122125 if let Some ( previous_hash) = self . previous_hashes . get ( file_path) {
123126 if * previous_hash == hash {
124127 return ; // do not bother updating the db file because nothing has changed
@@ -262,7 +265,7 @@ mod test {
262265 let sql_cache = SqlIncrementalCache :: new ( conn, CacheDBHash :: new ( 1 ) ) ;
263266 let file_path = PathBuf :: from ( "/mod.ts" ) ;
264267 let file_text = "test" ;
265- let file_hash = CacheDBHash :: from_source ( file_text) ;
268+ let file_hash = CacheDBHash :: from_hashable ( file_text) ;
266269 sql_cache. set_source_hash ( & file_path, file_hash) . unwrap ( ) ;
267270 let cache = IncrementalCacheInner :: from_sql_incremental_cache (
268271 sql_cache,
0 commit comments