diff --git a/FiraSans-Medium.woff2 b/FiraSans-Medium.woff2 new file mode 100644 index 0000000..7a1e5fc Binary files /dev/null and b/FiraSans-Medium.woff2 differ diff --git a/FiraSans-Regular.woff2 b/FiraSans-Regular.woff2 new file mode 100644 index 0000000..e766e06 Binary files /dev/null and b/FiraSans-Regular.woff2 differ diff --git a/actix_example/all.html b/actix_example/all.html index 0c403b5..adbec65 100644 --- a/actix_example/all.html +++ b/actix_example/all.html @@ -1,7 +1,7 @@ -
pub(crate) fn get_full_path_runner(path: &str, files: &Files) -> bool
pub(crate) fn get_full_path_runner(path: &str, files: &Files) -> bool
pub(crate) fn main()
pub(crate) fn main()
get_full_path_runner | |
main |
get_full_path_runner | |
main |
pub const CACHE_BUSTER_DATA_FILE: &str = "./src/cache_buster_data.json";
file to which filemap is written during compilation +
pub const CACHE_BUSTER_DATA_FILE: &str = "./src/cache_buster_data.json";
file to which filemap is written during compilation
include this to .gitignore
Module describing runtime compoenet for fetching modified filenames
+Module describing runtime compoenet for fetching modified filenames
Add the following tou your program to load the filemap during compiletime:
@@ -13,5 +13,5 @@ }
Files | Filemap struct - |
Filemap struct
+Filemap struct
maps original names to generated names
impl Files
[src]pub fn new(map: &str) -> Self
[src]Load filemap in main program. Should be called from main program
pub fn get<'a>(&'a self, path: &'a str) -> Option<&'a str>
[src]impl Clone for Files
[src]fn clone(&self) -> Files
[src]pub fn clone_from(&mut self, source: &Self)
1.0.0[src]pub fn clone_from(&mut self, source: &Self)
1.0.0[src]impl Debug for Files
[src]impl<'de> Deserialize<'de> for Files
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]impl PartialEq<Files> for Files
[src]impl Serialize for Files
[src]fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]impl StructuralPartialEq for Files
[src]impl RefUnwindSafe for Files
[src]impl Send for Files
[src]impl Sync for Files
[src]impl Unpin for Files
[src]impl UnwindSafe for Files
[src]impl<T> Any for T where
T: 'static + ?Sized,
[src]impl<T> Borrow<T> for T where
T: ?Sized,
[src]impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]impl<T> From<T> for T
[src]impl<T, U> Into<U> for T where
U: From<T>,
[src]impl StructuralPartialEq for Files
[src]impl RefUnwindSafe for Files
impl Send for Files
impl Sync for Files
impl Unpin for Files
impl UnwindSafe for Files
impl<T> Any for T where
T: 'static + ?Sized,
[src]impl<T> Borrow<T> for T where
T: ?Sized,
[src]impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]impl<T> From<T> for T
[src]impl<T, U> Into<U> for T where
U: From<T>,
[src]impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
The resulting type after obtaining ownership.
-pub fn to_owned(&self) -> T
[src]pub fn clone_into(&self, target: &mut T)
[src]impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
The resulting type after obtaining ownership.
+pub fn to_owned(&self) -> T
[src]pub fn clone_into(&self, target: &mut T)
[src]impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]type Error = Infallible
The type returned in the event of a conversion error.
-pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]type Error = Infallible
The type returned in the event of a conversion error.
+pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]To optimise network load time, browsers cache static files. Caching +greatly improves performance but how do you inform browsers to +invalidate cache when your files have changed?
+Cache busting is a simple but effective solution for this issue. There +are several ways to achieve this but the way this library does this is +by changing file names to include the hash of the files’ contents.
+So if you have bundle.js
, it will become
+bundle.<long-sha256-hash>.js
. This lets you set a super long cache age
+as, because of the file names changing, the path to the filename, too,
+will change. So as far as the browser is concerned, you are trying to load
+a file that it doesn’t have. Pretty neat, isn’t it?
build.rs
use cache_buster::BusterBuilder; @@ -26,6 +42,21 @@ config.process().unwrap(); }
main.rs
:Module describing runtime compoenet for fetching modified filenames
+Add the following tou your program to load the filemap during compiletime:
+ ++use cache_buster::Files; +use cache_buster::CACHE_BUSTER_DATA_FILE; + +fn main(){ + let files = Files::new(CACHE_BUSTER_DATA_FILE); + // the path to the file before setting up for cache busting + files.get("./dist/github.svg"); +}
pub use processor::BusterBuilder; |
pub use filemap::Files; |
filemap | Module describing runtime compoenet for fetching modified filenames @@ -33,5 +64,5 @@ |
CACHE_BUSTER_DATA_FILE | file to which filemap is written during compilation
include this to |
impl<T> ToString for T where
T: Display + ?Sized,
[src]impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]type Error = Infallible
The type returned in the event of a conversion error.
+pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]Module describing file processor that changes filenames to setup cache-busting
+Module describing file processor that changes filenames to setup cache-busting
Run the following during build using build.rs
:
@@ -28,12 +28,12 @@ config.process().unwrap(); }
There's a runtime component to this library which will let you read modified +
There’s a runtime component to this library which will let you read modified filenames from within your program. See [Files]
Buster | Configuration for setting up cache-busting |
BusterBuilder | Builder for |
BusterBuilderError | Error type for BusterBuilder - |
Configuration for setting up cache-busting
+Configuration for setting up cache-busting
impl Buster
[src]pub fn process(&self) -> Result<(), Error>
[src]Processes files.
Panics when a weird MIME is encountered.
impl Clone for Buster
[src]fn clone(&self) -> Buster
[src]pub fn clone_from(&mut self, source: &Self)
1.0.0[src]pub fn clone_from(&mut self, source: &Self)
1.0.0[src]impl Debug for Buster
[src]impl RefUnwindSafe for Buster
[src]impl Send for Buster
[src]impl Sync for Buster
[src]impl Unpin for Buster
[src]impl UnwindSafe for Buster
[src]impl<T> Any for T where
T: 'static + ?Sized,
[src]impl<T> Borrow<T> for T where
T: ?Sized,
[src]impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]impl<T> From<T> for T
[src]impl<T, U> Into<U> for T where
U: From<T>,
[src]impl RefUnwindSafe for Buster
impl Send for Buster
impl Sync for Buster
impl Unpin for Buster
impl UnwindSafe for Buster
impl<T> Any for T where
T: 'static + ?Sized,
[src]impl<T> Borrow<T> for T where
T: ?Sized,
[src]impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]impl<T> From<T> for T
[src]impl<T, U> Into<U> for T where
U: From<T>,
[src]impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
The resulting type after obtaining ownership.
-pub fn to_owned(&self) -> T
[src]pub fn clone_into(&self, target: &mut T)
[src]impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
The resulting type after obtaining ownership.
+pub fn to_owned(&self) -> T
[src]pub fn clone_into(&self, target: &mut T)
[src]impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]type Error = Infallible
The type returned in the event of a conversion error.
-pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]type Error = Infallible
The type returned in the event of a conversion error.
+pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]Builder for Buster
.
Builder for Buster
.
impl BusterBuilder
[src]pub fn source<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
[src]source directory
pub fn mime_types(&mut self, value: Vec<Mime>) -> &mut Self
[src]mime_types for hashing
pub fn result<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
[src]directory for writing results
@@ -12,21 +12,21 @@If a required field has not been initialized.
impl Clone for BusterBuilder
[src]fn clone(&self) -> BusterBuilder
[src]pub fn clone_from(&mut self, source: &Self)
1.0.0[src]impl Default for BusterBuilder
[src]impl RefUnwindSafe for BusterBuilder
[src]impl Send for BusterBuilder
[src]impl Sync for BusterBuilder
[src]impl Unpin for BusterBuilder
[src]impl UnwindSafe for BusterBuilder
[src]impl<T> Any for T where
T: 'static + ?Sized,
[src]impl<T> Borrow<T> for T where
T: ?Sized,
[src]impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]impl<T> From<T> for T
[src]impl<T, U> Into<U> for T where
U: From<T>,
[src]pub fn into(self) -> U
[src]pub fn clone_from(&mut self, source: &Self)
1.0.0[src]impl Default for BusterBuilder
[src]impl RefUnwindSafe for BusterBuilder
impl Send for BusterBuilder
impl Sync for BusterBuilder
impl Unpin for BusterBuilder
impl UnwindSafe for BusterBuilder
impl<T> Any for T where
T: 'static + ?Sized,
[src]impl<T> Borrow<T> for T where
T: ?Sized,
[src]impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]impl<T> From<T> for T
[src]impl<T, U> Into<U> for T where
U: From<T>,
[src]impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
The resulting type after obtaining ownership.
-pub fn to_owned(&self) -> T
[src]pub fn clone_into(&self, target: &mut T)
[src]impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
The resulting type after obtaining ownership.
+pub fn to_owned(&self) -> T
[src]pub fn clone_into(&self, target: &mut T)
[src]impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]type Error = Infallible
The type returned in the event of a conversion error.
-pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]type Error = Infallible
The type returned in the event of a conversion error.
+pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]"+""+(item.is_alias===true?(""+item.alias+" - see "):"")+item.displayPath+""+name+" | "+""+""+item.desc+" |
"+code.outerHTML+" |
fn:
) to \
+if(!String.prototype.startsWith){String.prototype.startsWith=function(searchString,position){position=position||0;return this.indexOf(searchString,position)===position}}if(!String.prototype.endsWith){String.prototype.endsWith=function(suffix,length){var l=length||this.length;return this.indexOf(suffix,l-suffix.length)!==-1}}if(!DOMTokenList.prototype.add){DOMTokenList.prototype.add=function(className){if(className&&!hasClass(this,className)){if(this.className&&this.className.length>0){this.className+=" "+className}else{this.className=className}}}}if(!DOMTokenList.prototype.remove){DOMTokenList.prototype.remove=function(className){if(className&&this.className){this.className=(" "+this.className+" ").replace(" "+className+" "," ").trim()}}}(function(){var rustdocVars=document.getElementById("rustdoc-vars");if(rustdocVars){window.rootPath=rustdocVars.attributes["data-root-path"].value;window.currentCrate=rustdocVars.attributes["data-current-crate"].value;window.searchJS=rustdocVars.attributes["data-search-js"].value}var sidebarVars=document.getElementById("sidebar-vars");if(sidebarVars){window.sidebarCurrent={name:sidebarVars.attributes["data-name"].value,ty:sidebarVars.attributes["data-ty"].value,relpath:sidebarVars.attributes["data-relpath"].value,}}}());function getVirtualKey(ev){if("key"in ev&&typeof ev.key!="undefined"){return ev.key}var c=ev.charCode||ev.keyCode;if(c==27){return"Escape"}return String.fromCharCode(c)}function getSearchInput(){return document.getElementsByClassName("search-input")[0]}function getSearchElement(){return document.getElementById("search")}function getThemesElement(){return document.getElementById("theme-choices")}function getThemePickerElement(){return document.getElementById("theme-picker")}function getNakedUrl(){return window.location.href.split("?")[0].split("#")[0]}function focusSearchBar(){getSearchInput().focus()}function defocusSearchBar(){getSearchInput().blur()}(function(){"use strict";var itemTypes=["mod","externcrate","import","struct","enum","fn","type","static","trait","impl","tymethod","method","structfield","variant","macro","primitive","associatedtype","constant","associatedconstant","union","foreigntype","keyword","existential","attr","derive","traitalias"];var disableShortcuts=getSettingValue("disable-shortcuts")==="true";var search_input=getSearchInput();var searchTimeout=null;var toggleAllDocsId="toggle-all-docs";var currentTab=0;var mouseMovedAfterSearch=true;var titleBeforeSearch=document.title;var searchTitle=null;function clearInputTimeout(){if(searchTimeout!==null){clearTimeout(searchTimeout);searchTimeout=null}}function getPageId(){if(window.location.hash){var tmp=window.location.hash.replace(/^#/,"");if(tmp.length>0){return tmp}}return null}function showSidebar(){var elems=document.getElementsByClassName("sidebar-elems")[0];if(elems){addClass(elems,"show-it")}var sidebar=document.getElementsByClassName("sidebar")[0];if(sidebar){addClass(sidebar,"mobile");var filler=document.getElementById("sidebar-filler");if(!filler){var div=document.createElement("div");div.id="sidebar-filler";sidebar.appendChild(div)}}}function hideSidebar(){var elems=document.getElementsByClassName("sidebar-elems")[0];if(elems){removeClass(elems,"show-it")}var sidebar=document.getElementsByClassName("sidebar")[0];removeClass(sidebar,"mobile");var filler=document.getElementById("sidebar-filler");if(filler){filler.remove()}document.getElementsByTagName("body")[0].style.marginTop=""}function showSearchResults(search){if(search===null||typeof search==='undefined'){search=getSearchElement()}addClass(main,"hidden");removeClass(search,"hidden");mouseMovedAfterSearch=false;document.title=searchTitle}function hideSearchResults(search){if(search===null||typeof search==='undefined'){search=getSearchElement()}addClass(search,"hidden");removeClass(main,"hidden");document.title=titleBeforeSearch;if(browserSupportsHistoryApi()){history.replaceState("",window.currentCrate+" - Rust",getNakedUrl()+window.location.hash)}}var TY_PRIMITIVE=itemTypes.indexOf("primitive");var TY_KEYWORD=itemTypes.indexOf("keyword");function getQueryStringParams(){var params={};window.location.search.substring(1).split("&").map(function(s){var pair=s.split("=");params[decodeURIComponent(pair[0])]=typeof pair[1]==="undefined"?null:decodeURIComponent(pair[1])});return params}function browserSupportsHistoryApi(){return window.history&&typeof window.history.pushState==="function"}function isHidden(elem){return elem.offsetHeight===0}var main=document.getElementById("main");var savedHash="";function handleHashes(ev){var elem;var search=getSearchElement();if(ev!==null&&search&&!hasClass(search,"hidden")&&ev.newURL){hideSearchResults(search);var hash=ev.newURL.slice(ev.newURL.indexOf("#")+1);if(browserSupportsHistoryApi()){history.replaceState(hash,"",getNakedUrl()+window.location.search+"#"+hash)}elem=document.getElementById(hash);if(elem){elem.scrollIntoView()}}if(savedHash!==window.location.hash){savedHash=window.location.hash;if(savedHash.length===0){return}elem=document.getElementById(savedHash.slice(1));if(!elem||!isHidden(elem)){return}var parent=elem.parentNode;if(parent&&hasClass(parent,"impl-items")){onEachLazy(parent.getElementsByClassName("collapsed"),function(e){if(e.parentNode===parent){e.click();return true}});if(isHidden(elem)){if(hasClass(parent.lastElementChild,"collapse-toggle")){parent.lastElementChild.click()}}}}}function highlightSourceLines(match,ev){if(typeof match==="undefined"){hideSidebar();match=window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/)}if(!match){return}var from=parseInt(match[1],10);var to=from;if(typeof match[2]!=="undefined"){to=parseInt(match[2],10)}if(to"+""+(item.is_alias===true?(""+item.alias+" - see "):"")+item.displayPath+""+name+" | "+""+""+item.desc+" |
"+code.outerHTML+" |
fn:
) to \
restrict the search to a given item kind.","Accepted kinds are: fn
, mod
, struct
, \
enum
, trait
, type
, macro
, \
and const
.","Search functions by type signature (e.g., vec -> usize
or \
* -> vec
)","Search multiple things at once by splitting your query with comma (e.g., \
str,u8
or String,struct:Vec,test
)","You can look for items with an exact name by putting double quotes around \
- your request: \"string\"
","Look for items inside another one by searching for a path: vec::Vec
",].map(x=>""+x+"
").join("");var div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="\"string\"
","Look for items inside another one by searching for a path: vec::Vec
",].map(function(x){return""+x+"
"}).join("");var div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="Buster
.",null,null],[11,"source","","source directory",0,[[["into",8],["string",3]]]],[11,"mime_types","","mime_types for hashing",0,[[["mime",3],["vec",3]]]],[11,"result","","directory for writing results",0,[[["into",8],["string",3]]]],[11,"prefix","","route prefixes",0,[[["into",8],["string",3]]]],[11,"copy","","copy other non-hashed files from source dire to result …",0,[[["bool",15]]]],[11,"follow_links","","follow symlinks?",0,[[["bool",15]]]],[11,"build","","Builds a new Buster
.",0,[[],[["buster",3],["result",4],["busterbuildererror",4]]]],[4,"BusterBuilderError","","Error type for BusterBuilder",null,null],[13,"UninitializedField","","Uninitialized field",1,null],[13,"ValidationError","","Custom validation error",1,null],[11,"process","","Processes files.",2,[[],[["result",4],["error",3]]]],[0,"filemap","cache_buster","Module describing runtime compoenet for fetching modified …",null,null],[3,"Files","cache_buster::filemap","Filemap struct",null,null],[11,"new","","Load filemap in main program. Should be called from main …",3,[[["str",15]]]],[11,"get","","Get relative file path",3,[[["str",15]],[["option",4],["str",15]]]],[11,"get_full_path","","Get file path",3,[[["str",15]],[["option",4],["string",3]]]],[17,"CACHE_BUSTER_DATA_FILE","cache_buster","file to which filemap is written during compilation …",null,null],[11,"from","cache_buster::processor","",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","cache_buster::filemap","",3,[[]]],[11,"into","","",3,[[]]],[11,"to_owned","","",3,[[]]],[11,"clone_into","","",3,[[]]],[11,"borrow","","",3,[[]]],[11,"borrow_mut","","",3,[[]]],[11,"try_from","","",3,[[],["result",4]]],[11,"try_into","","",3,[[],["result",4]]],[11,"type_id","","",3,[[],["typeid",3]]],[11,"from","cache_buster::processor","",1,[[["uninitializedfielderror",3]]]],[11,"from","","",1,[[["string",3]]]],[11,"clone","","",2,[[],["buster",3]]],[11,"clone","","",0,[[],["busterbuilder",3]]],[11,"clone","cache_buster::filemap","",3,[[],["files",3]]],[11,"default","cache_buster::processor","",0,[[]]],[11,"eq","cache_buster::filemap","",3,[[["files",3]],["bool",15]]],[11,"ne","","",3,[[["files",3]],["bool",15]]],[11,"fmt","cache_buster::processor","",2,[[["formatter",3]],["result",6]]],[11,"fmt","","",1,[[["formatter",3]],["result",6]]],[11,"fmt","cache_buster::filemap","",3,[[["formatter",3]],["result",6]]],[11,"fmt","cache_buster::processor","",1,[[["formatter",3]],["result",6]]],[11,"serialize","cache_buster::filemap","",3,[[],["result",4]]],[11,"deserialize","","",3,[[],["result",4]]]],"p":[[3,"BusterBuilder"],[4,"BusterBuilderError"],[3,"Buster"],[3,"Files"]]}\
+"actix_example":{"doc":"","t":[5,5],"n":["main","get_full_path_runner"],"q":["actix_example",""],"d":["",""],"i":[0,0],"f":[[[]],[[["files",3],["str",15]],["bool",15]]],"p":[]},\
+"cache_buster":{"doc":"What is cache busting?","t":[0,3,3,11,11,11,11,11,11,11,4,13,13,11,0,3,11,11,11,17,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11],"n":["processor","Buster","BusterBuilder","source","mime_types","result","prefix","copy","follow_links","build","BusterBuilderError","UninitializedField","ValidationError","process","filemap","Files","new","get","get_full_path","CACHE_BUSTER_DATA_FILE","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","from","into","to_string","borrow","borrow_mut","try_from","try_into","type_id","from","into","to_owned","clone_into","borrow","borrow_mut","try_from","try_into","type_id","from","from","clone","clone","clone","default","eq","ne","fmt","fmt","fmt","fmt","serialize","deserialize"],"q":["cache_buster","cache_buster::processor","","","","","","","","","","","","","cache_buster","cache_buster::filemap","","","","cache_buster","cache_buster::processor","","","","","","","","","","","","","","","","","","","","","","","","","","cache_buster::filemap","","","","","","","","","cache_buster::processor","","","","cache_buster::filemap","cache_buster::processor","cache_buster::filemap","","cache_buster::processor","","cache_buster::filemap","cache_buster::processor","cache_buster::filemap",""],"d":["Module describing file processor that changes filenames …","Configuration for setting up cache-busting","Builder for Buster
.","source directory","mime_types for hashing","directory for writing results","route prefixes","copy other non-hashed files from source dire to result …","follow symlinks?","Builds a new Buster
.","Error type for BusterBuilder","Uninitialized field","Custom validation error","Processes files.","Module describing runtime compoenet for fetching modified …","Filemap struct","Load filemap in main program. Should be called from main …","Get relative file path","Get file path","file to which filemap is written during compilation …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"i":[0,0,0,1,1,1,1,1,1,1,0,2,2,3,0,0,4,4,4,0,3,3,3,3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,4,4,4,4,4,4,4,4,4,2,2,3,1,4,1,4,4,3,2,4,2,4,4],"f":[null,null,null,[[["string",3],["into",8]]],[[["mime",3],["vec",3]]],[[["string",3],["into",8]]],[[["string",3],["into",8]]],[[["bool",15]]],[[["bool",15]]],[[],[["busterbuildererror",4],["result",4],["buster",3]]],null,null,null,[[],[["error",3],["result",4]]],null,null,[[["str",15]]],[[["str",15]],[["option",4],["str",15]]],[[["str",15]],[["option",4],["string",3]]],null,[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[],["string",3]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[["uninitializedfielderror",3]]],[[["string",3]]],[[],["buster",3]],[[],["busterbuilder",3]],[[],["files",3]],[[]],[[["files",3]],["bool",15]],[[["files",3]],["bool",15]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[],["result",4]],[[],["result",4]]],"p":[[3,"BusterBuilder"],[4,"BusterBuilderError"],[3,"Buster"],[3,"Files"]]}\
}');
-addSearchOptions(searchIndex);initSearch(searchIndex);
\ No newline at end of file
+initSearch(searchIndex);
\ No newline at end of file
diff --git a/settings.html b/settings.html
index 85fb0e9..f76d39b 100644
--- a/settings.html
+++ b/settings.html
@@ -1,7 +1,7 @@
-1 +- \ No newline at end of file + 1 2 3 4 @@ -61,5 +61,5 @@ } }-
1 +- \ No newline at end of file + 1 2 3 4 @@ -337,5 +337,5 @@ } }-
1 +- \ No newline at end of file + 1 2 3 4 @@ -42,6 +42,41 @@ 39 40 41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76-/* * Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net> @@ -50,6 +85,25 @@ * License. */ #![warn(missing_docs, missing_debug_implementations, rust_2018_idioms)] +//! # What is cache busting? +//! +//! To optimise network load time, browsers cache static files. Caching +//! greatly improves performance but how do you inform browsers to +//! invalidate cache when your files have changed? +//! +//! Cache busting is a simple but effective solution for this issue. There +//! are several ways to achieve this but the way this library does this is +//! by changing file names to include the hash of the files' contents. +//! +//! So if you have `bundle.js`, it will become +//! `bundle.<long-sha256-hash>.js`. This lets you set a super long cache age +//! as, because of the file names changing, the path to the filename, too, +//! will change. So as far as the browser is concerned, you are trying to load +//! a file that it doesn't have. Pretty neat, isn't it? +//! +//! ## Example: +//! +//! - `build.rs` //! ```no_run //! use cache_buster::BusterBuilder; //! @@ -75,6 +129,22 @@ //! config.process().unwrap(); //! } //! ``` +//! - `main.rs`: +//! +//! Module describing runtime compoenet for fetching modified filenames +//! +//! Add the following tou your program to load the filemap during compiletime: +//! +//! ```no_run +//! use cache_buster::Files; +//! use cache_buster::CACHE_BUSTER_DATA_FILE; +//! +//! fn main(){ +//! let files = Files::new(CACHE_BUSTER_DATA_FILE); +//! // the path to the file before setting up for cache busting +//! files.get("./dist/github.svg"); +//! } +//! ``` pub mod processor; pub use processor::BusterBuilder; @@ -85,5 +155,5 @@ /// include this to `.gitignore` pub const CACHE_BUSTER_DATA_FILE: &str = "./src/cache_buster_data.json";
1 +- \ No newline at end of file + 1 2 3 4 @@ -703,5 +703,5 @@ } }-