diff --git a/cache_buster/hash/index.html b/cache_buster/hash/index.html index 7e43008..e4a4a81 100644 --- a/cache_buster/hash/index.html +++ b/cache_buster/hash/index.html @@ -1,7 +1,7 @@ cache_buster::hash - Rust

Module cache_buster::hash[][src]

Structs

+ Change settings

Module cache_buster::hash[][src]

Structs

Buster
BusterBuilder

Builder for Buster.

Enums

BusterBuilderError

Error type for BusterBuilder

diff --git a/search-index.js b/search-index.js index e54a25e..7413068 100644 --- a/search-index.js +++ b/search-index.js @@ -1,4 +1,4 @@ var searchIndex = JSON.parse('{\ -"cache_buster":{"doc":"","i":[[0,"hash","cache_buster","",null,null],[3,"Buster","cache_buster::hash","",null,null],[3,"BusterBuilder","","Builder for Buster.",null,null],[11,"source","","",0,[[["string",3],["into",8]]]],[11,"mime_types","","",0,[[["mime",3],["vec",3]]]],[11,"result","","",0,[[["string",3],["into",8]]]],[11,"copy","","",0,[[["bool",15]]]],[11,"follow_links","","",0,[[["bool",15]]]],[11,"build","","Builds a new Buster.",0,[[],[["busterbuildererror",4],["result",4],["buster",3]]]],[4,"BusterBuilderError","","Error type for BusterBuilder",null,null],[13,"UninitializedField","","Uninitialized field",1,null],[13,"ValidationError","","Custom validation error",1,null],[11,"init","","",2,[[],[["result",4],["error",3]]]],[11,"try_hash","","",2,[[],[["result",4],["hashmap",3],["error",3]]]],[11,"hash","","",2,[[],[["result",4],["hashmap",3],["error",3]]]],[11,"from","","",2,[[]]],[11,"into","","",2,[[]]],[11,"to_owned","","",2,[[]]],[11,"clone_into","","",2,[[]]],[11,"borrow","","",2,[[]]],[11,"borrow_mut","","",2,[[]]],[11,"try_from","","",2,[[],["result",4]]],[11,"try_into","","",2,[[],["result",4]]],[11,"type_id","","",2,[[],["typeid",3]]],[11,"from","","",0,[[]]],[11,"into","","",0,[[]]],[11,"to_owned","","",0,[[]]],[11,"clone_into","","",0,[[]]],[11,"borrow","","",0,[[]]],[11,"borrow_mut","","",0,[[]]],[11,"try_from","","",0,[[],["result",4]]],[11,"try_into","","",0,[[],["result",4]]],[11,"type_id","","",0,[[],["typeid",3]]],[11,"from","","",1,[[]]],[11,"into","","",1,[[]]],[11,"to_string","","",1,[[],["string",3]]],[11,"borrow","","",1,[[]]],[11,"borrow_mut","","",1,[[]]],[11,"try_from","","",1,[[],["result",4]]],[11,"try_into","","",1,[[],["result",4]]],[11,"type_id","","",1,[[],["typeid",3]]],[11,"from","","",1,[[["uninitializedfielderror",3]]]],[11,"from","","",1,[[["string",3]]]],[11,"clone","","",2,[[],["buster",3]]],[11,"clone","","",0,[[],["busterbuilder",3]]],[11,"default","","",0,[[]]],[11,"fmt","","",2,[[["formatter",3]],["result",6]]],[11,"fmt","","",1,[[["formatter",3]],["result",6]]],[11,"fmt","","",1,[[["formatter",3]],["result",6]]]],"p":[[3,"BusterBuilder"],[4,"BusterBuilderError"],[3,"Buster"]]}\ +"cache_buster":{"doc":"","i":[[0,"hash","cache_buster","",null,null],[3,"Buster","cache_buster::hash","",null,null],[3,"BusterBuilder","","Builder for Buster.",null,null],[11,"source","","",0,[[["string",3],["into",8]]]],[11,"mime_types","","",0,[[["mime",3],["vec",3]]]],[11,"result","","",0,[[["string",3],["into",8]]]],[11,"copy","","",0,[[["bool",15]]]],[11,"follow_links","","",0,[[["bool",15]]]],[11,"build","","Builds a new Buster.",0,[[],[["buster",3],["busterbuildererror",4],["result",4]]]],[4,"BusterBuilderError","","Error type for BusterBuilder",null,null],[13,"UninitializedField","","Uninitialized field",1,null],[13,"ValidationError","","Custom validation error",1,null],[11,"init","","",2,[[],[["result",4],["error",3]]]],[11,"try_hash","","",2,[[],[["result",4],["hashmap",3],["error",3]]]],[11,"hash","","",2,[[],[["result",4],["hashmap",3],["error",3]]]],[11,"from","","",2,[[]]],[11,"into","","",2,[[]]],[11,"to_owned","","",2,[[]]],[11,"clone_into","","",2,[[]]],[11,"borrow","","",2,[[]]],[11,"borrow_mut","","",2,[[]]],[11,"try_from","","",2,[[],["result",4]]],[11,"try_into","","",2,[[],["result",4]]],[11,"type_id","","",2,[[],["typeid",3]]],[11,"from","","",0,[[]]],[11,"into","","",0,[[]]],[11,"to_owned","","",0,[[]]],[11,"clone_into","","",0,[[]]],[11,"borrow","","",0,[[]]],[11,"borrow_mut","","",0,[[]]],[11,"try_from","","",0,[[],["result",4]]],[11,"try_into","","",0,[[],["result",4]]],[11,"type_id","","",0,[[],["typeid",3]]],[11,"from","","",1,[[]]],[11,"into","","",1,[[]]],[11,"to_string","","",1,[[],["string",3]]],[11,"borrow","","",1,[[]]],[11,"borrow_mut","","",1,[[]]],[11,"try_from","","",1,[[],["result",4]]],[11,"try_into","","",1,[[],["result",4]]],[11,"type_id","","",1,[[],["typeid",3]]],[11,"from","","",1,[[["uninitializedfielderror",3]]]],[11,"from","","",1,[[["string",3]]]],[11,"clone","","",2,[[],["buster",3]]],[11,"clone","","",0,[[],["busterbuilder",3]]],[11,"default","","",0,[[]]],[11,"fmt","","",2,[[["formatter",3]],["result",6]]],[11,"fmt","","",1,[[["formatter",3]],["result",6]]],[11,"fmt","","",1,[[["formatter",3]],["result",6]]]],"p":[[3,"BusterBuilder"],[4,"BusterBuilderError"],[3,"Buster"]]}\ }'); addSearchOptions(searchIndex);initSearch(searchIndex); \ No newline at end of file diff --git a/src/cache_buster/hash.rs.html b/src/cache_buster/hash.rs.html index 2b214b0..7c2352e 100644 --- a/src/cache_buster/hash.rs.html +++ b/src/cache_buster/hash.rs.html @@ -218,6 +218,35 @@ 215 216 217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246
 /*
 * Copyright (C) 2021  Aravinth Manivannan <realaravinth@batsense.net>
@@ -435,6 +464,35 @@
             assert_eq!(src.exists(), dest.exists());
         }
     }
+
+    #[test]
+    fn try_hash_works() {
+        let types = vec![
+            mime::IMAGE_PNG,
+            mime::IMAGE_SVG,
+            mime::IMAGE_JPEG,
+            mime::IMAGE_GIF,
+        ];
+
+        let config = BusterBuilder::default()
+            .source("./dist")
+            .result("/tmp/prod")
+            .mime_types(types)
+            .copy(true)
+            .follow_links(true)
+            .build()
+            .unwrap();
+
+        config.init().unwrap();
+        let mut map = config.hash().unwrap();
+
+        for (k, v) in map.drain() {
+            let src = Path::new(&k);
+            let dest = Path::new(&v);
+
+            assert_eq!(src.exists(), dest.exists());
+        }
+    }
 }