From 443e12e0e5bdae216760637d7d5d1249d2bd7dd6 Mon Sep 17 00:00:00 2001 From: realaravinth Date: Thu, 8 Apr 2021 14:36:43 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20=20@=20e09a6?= =?UTF-8?q?ad0cb5926735ca85f2ad030c593ff54d7b2=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cache_buster/all.html | 2 +- .../{ => hash}/enum.BusterBuilderError.html | 24 +- cache_buster/hash/index.html | 9 + cache_buster/hash/sidebar-items.js | 1 + cache_buster/hash/struct.Buster.html | 22 + .../{ => hash}/struct.BusterBuilder.html | 20 +- cache_buster/index.html | 12 +- cache_buster/sidebar-items.js | 2 +- cache_buster/struct.Buster.html | 22 - implementors/core/clone/trait.Clone.js | 2 +- implementors/core/convert/trait.From.js | 2 +- implementors/core/default/trait.Default.js | 2 +- implementors/core/fmt/trait.Debug.js | 2 +- implementors/core/fmt/trait.Display.js | 2 +- implementors/core/marker/trait.Freeze.js | 2 +- implementors/core/marker/trait.Send.js | 2 +- implementors/core/marker/trait.Sync.js | 2 +- implementors/core/marker/trait.Unpin.js | 2 +- implementors/std/error/trait.Error.js | 2 +- implementors/std/panic/trait.RefUnwindSafe.js | 2 +- implementors/std/panic/trait.UnwindSafe.js | 2 +- search-index.js | 2 +- source-files.js | 2 +- src/cache_buster/hash.rs.html | 441 ++++++++++++++++++ src/cache_buster/lib.rs.html | 386 ++------------- 25 files changed, 554 insertions(+), 415 deletions(-) rename cache_buster/{ => hash}/enum.BusterBuilderError.html (56%) create mode 100644 cache_buster/hash/index.html create mode 100644 cache_buster/hash/sidebar-items.js create mode 100644 cache_buster/hash/struct.Buster.html rename cache_buster/{ => hash}/struct.BusterBuilder.html (50%) delete mode 100644 cache_buster/struct.Buster.html create mode 100644 src/cache_buster/hash.rs.html diff --git a/cache_buster/all.html b/cache_buster/all.html index f37cff7..d0b82ab 100644 --- a/cache_buster/all.html +++ b/cache_buster/all.html @@ -3,5 +3,5 @@

List of all items[] -

Structs

Enums

+

Structs

Enums

\ No newline at end of file diff --git a/cache_buster/enum.BusterBuilderError.html b/cache_buster/hash/enum.BusterBuilderError.html similarity index 56% rename from cache_buster/enum.BusterBuilderError.html rename to cache_buster/hash/enum.BusterBuilderError.html index 330baff..055ce44 100644 --- a/cache_buster/enum.BusterBuilderError.html +++ b/cache_buster/hash/enum.BusterBuilderError.html @@ -1,7 +1,7 @@ -cache_buster::BusterBuilderError - Rust - -

Enum cache_buster::BusterBuilderError[][src]

#[non_exhaustive]pub enum BusterBuilderError {
+cache_buster::hash::BusterBuilderError - Rust
+
+

Enum cache_buster::hash::BusterBuilderError[][src]

#[non_exhaustive]pub enum BusterBuilderError {
     UninitializedField(&'static str),
     ValidationError(String),
 }

Error type for BusterBuilder

@@ -9,15 +9,15 @@ Variants (Non-exhaustive)
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
UninitializedField(&'static str)

Uninitialized field

ValidationError(String)

Custom validation error

-

Trait Implementations

impl Debug for BusterBuilderError[src]

impl Display for BusterBuilderError[src]

impl Error for BusterBuilderError[src]

Trait Implementations

impl Debug for BusterBuilderError[src]

impl Display for BusterBuilderError[src]

impl Error for BusterBuilderError[src]

impl From<String> for BusterBuilderError[src]

impl From<UninitializedFieldError> for BusterBuilderError[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl From<String> for BusterBuilderError[src]

impl From<UninitializedFieldError> for BusterBuilderError[src]

Auto Trait Implementations

Blanket Implementations

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]

impl<T> From<T> for T[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

- \ No newline at end of file +
+ \ No newline at end of file diff --git a/cache_buster/hash/index.html b/cache_buster/hash/index.html new file mode 100644 index 0000000..7e43008 --- /dev/null +++ b/cache_buster/hash/index.html @@ -0,0 +1,9 @@ +cache_buster::hash - Rust + +

Module cache_buster::hash[][src]

Structs

+
Buster
BusterBuilder

Builder for Buster.

+

Enums

+
BusterBuilderError

Error type for BusterBuilder

+
+ \ No newline at end of file diff --git a/cache_buster/hash/sidebar-items.js b/cache_buster/hash/sidebar-items.js new file mode 100644 index 0000000..1dfdbad --- /dev/null +++ b/cache_buster/hash/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"enum":[["BusterBuilderError","Error type for BusterBuilder"]],"struct":[["Buster",""],["BusterBuilder","Builder for `Buster`."]]}); \ No newline at end of file diff --git a/cache_buster/hash/struct.Buster.html b/cache_buster/hash/struct.Buster.html new file mode 100644 index 0000000..d2df357 --- /dev/null +++ b/cache_buster/hash/struct.Buster.html @@ -0,0 +1,22 @@ +cache_buster::hash::Buster - Rust + +

Struct cache_buster::hash::Buster[][src]

pub struct Buster { /* fields omitted */ }

Implementations

impl Buster[src]

pub fn init(&self) -> Result<(), Error>[src]

pub fn try_hash(&self) -> Result<HashMap<String, String>, Error>[src]

pub fn hash(&self) -> Result<HashMap<String, String>, Error>[src]

Trait Implementations

impl Clone for Buster[src]

impl Debug for Buster[src]

Auto Trait Implementations

Blanket Implementations

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]

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.

+

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.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/cache_buster/struct.BusterBuilder.html b/cache_buster/hash/struct.BusterBuilder.html similarity index 50% rename from cache_buster/struct.BusterBuilder.html rename to cache_buster/hash/struct.BusterBuilder.html index 10f2a3d..f5af589 100644 --- a/cache_buster/struct.BusterBuilder.html +++ b/cache_buster/hash/struct.BusterBuilder.html @@ -1,14 +1,14 @@ -cache_buster::BusterBuilder - Rust - -

Struct cache_buster::BusterBuilder[][src]

pub struct BusterBuilder { /* fields omitted */ }

Builder for Buster.

-

Implementations

impl BusterBuilder[src]

pub fn source<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self[src]

pub fn mime_types(&mut self, value: Vec<Mime>) -> &mut Self[src]

pub fn result<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self[src]

pub fn copy(&mut self, value: bool) -> &mut Self[src]

pub fn build(&self) -> Result<Buster, BusterBuilderError>[src]

Builds a new Buster.

+cache_buster::hash::BusterBuilder - Rust + +

Struct cache_buster::hash::BusterBuilder[][src]

pub struct BusterBuilder { /* fields omitted */ }

Builder for Buster.

+

Implementations

impl BusterBuilder[src]

pub fn source<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self[src]

pub fn mime_types(&mut self, value: Vec<Mime>) -> &mut Self[src]

pub fn result<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self[src]

pub fn copy(&mut self, value: bool) -> &mut Self[src]

pub fn build(&self) -> Result<Buster, BusterBuilderError>[src]

Builds a new Buster.

Errors

If a required field has not been initialized.

-

Trait Implementations

impl Clone for BusterBuilder[src]

Trait Implementations

impl Clone for BusterBuilder[src]

impl Default for BusterBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl Default for BusterBuilder[src]

Auto Trait Implementations

Blanket Implementations

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]

impl<T> From<T> for T[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

- \ No newline at end of file +
+ \ No newline at end of file diff --git a/cache_buster/index.html b/cache_buster/index.html index adef16f..272955f 100644 --- a/cache_buster/index.html +++ b/cache_buster/index.html @@ -1,7 +1,7 @@ cache_buster - Rust -

Crate cache_buster[][src]

+

Crate cache_buster[][src]

 use cache_buster::BusterBuilder;
 
@@ -27,9 +27,7 @@
     config.init().unwrap();
     config.hash().unwrap();
 }
-

Structs

-
Buster
BusterBuilder

Builder for Buster.

-

Enums

-
BusterBuilderError

Error type for BusterBuilder

-
+

Re-exports

+
pub use hash::BusterBuilder;

Modules

+
hash
\ No newline at end of file diff --git a/cache_buster/sidebar-items.js b/cache_buster/sidebar-items.js index 1dfdbad..05cafe7 100644 --- a/cache_buster/sidebar-items.js +++ b/cache_buster/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"enum":[["BusterBuilderError","Error type for BusterBuilder"]],"struct":[["Buster",""],["BusterBuilder","Builder for `Buster`."]]}); \ No newline at end of file +initSidebarItems({"mod":[["hash",""]]}); \ No newline at end of file diff --git a/cache_buster/struct.Buster.html b/cache_buster/struct.Buster.html deleted file mode 100644 index 1e33f42..0000000 --- a/cache_buster/struct.Buster.html +++ /dev/null @@ -1,22 +0,0 @@ -cache_buster::Buster - Rust - -

Struct cache_buster::Buster[][src]

pub struct Buster { /* fields omitted */ }

Implementations

impl Buster[src]

pub fn init(&self) -> Result<(), Error>[src]

pub fn try_hash(&self) -> Result<(), Error>[src]

pub fn hash(&self) -> Result<(), Error>[src]

Trait Implementations

impl Clone for Buster[src]

impl Debug for Buster[src]

Auto Trait Implementations

Blanket Implementations

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]

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.

-

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.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-
- \ No newline at end of file diff --git a/implementors/core/clone/trait.Clone.js b/implementors/core/clone/trait.Clone.js index 6adbc63..5e52e37 100644 --- a/implementors/core/clone/trait.Clone.js +++ b/implementors/core/clone/trait.Clone.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["cache_buster"] = [{"text":"impl Clone for Buster","synthetic":false,"types":["cache_buster::Buster"]},{"text":"impl Clone for BusterBuilder","synthetic":false,"types":["cache_buster::BusterBuilder"]}]; +implementors["cache_buster"] = [{"text":"impl Clone for Buster","synthetic":false,"types":["cache_buster::hash::Buster"]},{"text":"impl Clone for BusterBuilder","synthetic":false,"types":["cache_buster::hash::BusterBuilder"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/core/convert/trait.From.js b/implementors/core/convert/trait.From.js index e3bc8ca..be5b6d5 100644 --- a/implementors/core/convert/trait.From.js +++ b/implementors/core/convert/trait.From.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["cache_buster"] = [{"text":"impl From<UninitializedFieldError> for BusterBuilderError","synthetic":false,"types":["cache_buster::BusterBuilderError"]},{"text":"impl From<String> for BusterBuilderError","synthetic":false,"types":["cache_buster::BusterBuilderError"]}]; +implementors["cache_buster"] = [{"text":"impl From<UninitializedFieldError> for BusterBuilderError","synthetic":false,"types":["cache_buster::hash::BusterBuilderError"]},{"text":"impl From<String> for BusterBuilderError","synthetic":false,"types":["cache_buster::hash::BusterBuilderError"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/core/default/trait.Default.js b/implementors/core/default/trait.Default.js index a96e7a7..eb10252 100644 --- a/implementors/core/default/trait.Default.js +++ b/implementors/core/default/trait.Default.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["cache_buster"] = [{"text":"impl Default for BusterBuilder","synthetic":false,"types":["cache_buster::BusterBuilder"]}]; +implementors["cache_buster"] = [{"text":"impl Default for BusterBuilder","synthetic":false,"types":["cache_buster::hash::BusterBuilder"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/core/fmt/trait.Debug.js b/implementors/core/fmt/trait.Debug.js index fb8618c..813267e 100644 --- a/implementors/core/fmt/trait.Debug.js +++ b/implementors/core/fmt/trait.Debug.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["cache_buster"] = [{"text":"impl Debug for Buster","synthetic":false,"types":["cache_buster::Buster"]},{"text":"impl Debug for BusterBuilderError","synthetic":false,"types":["cache_buster::BusterBuilderError"]}]; +implementors["cache_buster"] = [{"text":"impl Debug for Buster","synthetic":false,"types":["cache_buster::hash::Buster"]},{"text":"impl Debug for BusterBuilderError","synthetic":false,"types":["cache_buster::hash::BusterBuilderError"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/core/fmt/trait.Display.js b/implementors/core/fmt/trait.Display.js index 14c2185..dc75e86 100644 --- a/implementors/core/fmt/trait.Display.js +++ b/implementors/core/fmt/trait.Display.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["cache_buster"] = [{"text":"impl Display for BusterBuilderError","synthetic":false,"types":["cache_buster::BusterBuilderError"]}]; +implementors["cache_buster"] = [{"text":"impl Display for BusterBuilderError","synthetic":false,"types":["cache_buster::hash::BusterBuilderError"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/core/marker/trait.Freeze.js b/implementors/core/marker/trait.Freeze.js index 9a45a52..b972981 100644 --- a/implementors/core/marker/trait.Freeze.js +++ b/implementors/core/marker/trait.Freeze.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["cache_buster"] = [{"text":"impl Freeze for Buster","synthetic":true,"types":["cache_buster::Buster"]},{"text":"impl Freeze for BusterBuilder","synthetic":true,"types":["cache_buster::BusterBuilder"]},{"text":"impl Freeze for BusterBuilderError","synthetic":true,"types":["cache_buster::BusterBuilderError"]}]; +implementors["cache_buster"] = [{"text":"impl Freeze for Buster","synthetic":true,"types":["cache_buster::hash::Buster"]},{"text":"impl Freeze for BusterBuilder","synthetic":true,"types":["cache_buster::hash::BusterBuilder"]},{"text":"impl Freeze for BusterBuilderError","synthetic":true,"types":["cache_buster::hash::BusterBuilderError"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/core/marker/trait.Send.js b/implementors/core/marker/trait.Send.js index 5efe241..4e20896 100644 --- a/implementors/core/marker/trait.Send.js +++ b/implementors/core/marker/trait.Send.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["cache_buster"] = [{"text":"impl Send for Buster","synthetic":true,"types":["cache_buster::Buster"]},{"text":"impl Send for BusterBuilder","synthetic":true,"types":["cache_buster::BusterBuilder"]},{"text":"impl Send for BusterBuilderError","synthetic":true,"types":["cache_buster::BusterBuilderError"]}]; +implementors["cache_buster"] = [{"text":"impl Send for Buster","synthetic":true,"types":["cache_buster::hash::Buster"]},{"text":"impl Send for BusterBuilder","synthetic":true,"types":["cache_buster::hash::BusterBuilder"]},{"text":"impl Send for BusterBuilderError","synthetic":true,"types":["cache_buster::hash::BusterBuilderError"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/core/marker/trait.Sync.js b/implementors/core/marker/trait.Sync.js index 2567646..60cc336 100644 --- a/implementors/core/marker/trait.Sync.js +++ b/implementors/core/marker/trait.Sync.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["cache_buster"] = [{"text":"impl Sync for Buster","synthetic":true,"types":["cache_buster::Buster"]},{"text":"impl Sync for BusterBuilder","synthetic":true,"types":["cache_buster::BusterBuilder"]},{"text":"impl Sync for BusterBuilderError","synthetic":true,"types":["cache_buster::BusterBuilderError"]}]; +implementors["cache_buster"] = [{"text":"impl Sync for Buster","synthetic":true,"types":["cache_buster::hash::Buster"]},{"text":"impl Sync for BusterBuilder","synthetic":true,"types":["cache_buster::hash::BusterBuilder"]},{"text":"impl Sync for BusterBuilderError","synthetic":true,"types":["cache_buster::hash::BusterBuilderError"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/core/marker/trait.Unpin.js b/implementors/core/marker/trait.Unpin.js index a328d66..2f871e8 100644 --- a/implementors/core/marker/trait.Unpin.js +++ b/implementors/core/marker/trait.Unpin.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["cache_buster"] = [{"text":"impl Unpin for Buster","synthetic":true,"types":["cache_buster::Buster"]},{"text":"impl Unpin for BusterBuilder","synthetic":true,"types":["cache_buster::BusterBuilder"]},{"text":"impl Unpin for BusterBuilderError","synthetic":true,"types":["cache_buster::BusterBuilderError"]}]; +implementors["cache_buster"] = [{"text":"impl Unpin for Buster","synthetic":true,"types":["cache_buster::hash::Buster"]},{"text":"impl Unpin for BusterBuilder","synthetic":true,"types":["cache_buster::hash::BusterBuilder"]},{"text":"impl Unpin for BusterBuilderError","synthetic":true,"types":["cache_buster::hash::BusterBuilderError"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/std/error/trait.Error.js b/implementors/std/error/trait.Error.js index f1951d9..71d8c03 100644 --- a/implementors/std/error/trait.Error.js +++ b/implementors/std/error/trait.Error.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["cache_buster"] = [{"text":"impl Error for BusterBuilderError","synthetic":false,"types":["cache_buster::BusterBuilderError"]}]; +implementors["cache_buster"] = [{"text":"impl Error for BusterBuilderError","synthetic":false,"types":["cache_buster::hash::BusterBuilderError"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/std/panic/trait.RefUnwindSafe.js b/implementors/std/panic/trait.RefUnwindSafe.js index 83eba3a..71cd722 100644 --- a/implementors/std/panic/trait.RefUnwindSafe.js +++ b/implementors/std/panic/trait.RefUnwindSafe.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["cache_buster"] = [{"text":"impl RefUnwindSafe for Buster","synthetic":true,"types":["cache_buster::Buster"]},{"text":"impl RefUnwindSafe for BusterBuilder","synthetic":true,"types":["cache_buster::BusterBuilder"]},{"text":"impl RefUnwindSafe for BusterBuilderError","synthetic":true,"types":["cache_buster::BusterBuilderError"]}]; +implementors["cache_buster"] = [{"text":"impl RefUnwindSafe for Buster","synthetic":true,"types":["cache_buster::hash::Buster"]},{"text":"impl RefUnwindSafe for BusterBuilder","synthetic":true,"types":["cache_buster::hash::BusterBuilder"]},{"text":"impl RefUnwindSafe for BusterBuilderError","synthetic":true,"types":["cache_buster::hash::BusterBuilderError"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/std/panic/trait.UnwindSafe.js b/implementors/std/panic/trait.UnwindSafe.js index 2067792..04d1574 100644 --- a/implementors/std/panic/trait.UnwindSafe.js +++ b/implementors/std/panic/trait.UnwindSafe.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["cache_buster"] = [{"text":"impl UnwindSafe for Buster","synthetic":true,"types":["cache_buster::Buster"]},{"text":"impl UnwindSafe for BusterBuilder","synthetic":true,"types":["cache_buster::BusterBuilder"]},{"text":"impl UnwindSafe for BusterBuilderError","synthetic":true,"types":["cache_buster::BusterBuilderError"]}]; +implementors["cache_buster"] = [{"text":"impl UnwindSafe for Buster","synthetic":true,"types":["cache_buster::hash::Buster"]},{"text":"impl UnwindSafe for BusterBuilder","synthetic":true,"types":["cache_buster::hash::BusterBuilder"]},{"text":"impl UnwindSafe for BusterBuilderError","synthetic":true,"types":["cache_buster::hash::BusterBuilderError"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/search-index.js b/search-index.js index 029298e..e54a25e 100644 --- a/search-index.js +++ b/search-index.js @@ -1,4 +1,4 @@ var searchIndex = JSON.parse('{\ -"cache_buster":{"doc":"","i":[[3,"Buster","cache_buster","",null,null],[3,"BusterBuilder","","Builder for Buster.",null,null],[11,"source","","",0,[[["into",8],["string",3]]]],[11,"mime_types","","",0,[[["vec",3],["mime",3]]]],[11,"result","","",0,[[["into",8],["string",3]]]],[11,"copy","","",0,[[["bool",15]]]],[11,"follow_links","","",0,[[["bool",15]]]],[11,"build","","Builds a new Buster.",0,[[],[["result",4],["buster",3],["busterbuildererror",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],["error",3]]]],[11,"hash","","",2,[[],[["result",4],["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,[[],[["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"]]}\ }'); addSearchOptions(searchIndex);initSearch(searchIndex); \ No newline at end of file diff --git a/source-files.js b/source-files.js index 952b597..68d9569 100644 --- a/source-files.js +++ b/source-files.js @@ -1,3 +1,3 @@ var N = null;var sourcesIndex = {}; -sourcesIndex["cache_buster"] = {"name":"","files":["lib.rs"]}; +sourcesIndex["cache_buster"] = {"name":"","files":["hash.rs","lib.rs"]}; createSourceSidebar(); diff --git a/src/cache_buster/hash.rs.html b/src/cache_buster/hash.rs.html new file mode 100644 index 0000000..2b214b0 --- /dev/null +++ b/src/cache_buster/hash.rs.html @@ -0,0 +1,441 @@ +hash.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 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
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+
+/*
+* Copyright (C) 2021  Aravinth Manivannan <realaravinth@batsense.net>
+*
+* Use of this source code is governed by the Apache 2.0 and/or the MIT
+* License.
+*/
+
+use std::collections::HashMap;
+use std::io::Error;
+use std::path::Path;
+use std::{fs, path::PathBuf};
+
+use derive_builder::Builder;
+use walkdir::WalkDir;
+
+#[derive(Debug, Clone, Builder)]
+pub struct Buster {
+    // source directory
+    #[builder(setter(into))]
+    source: String,
+    // mime_types for hashing
+    mime_types: Vec<mime::Mime>,
+    // directory for writing results
+    #[builder(setter(into))]
+    result: String,
+    // copy other non-hashed files from source dire to result dir?
+    copy: bool,
+    follow_links: bool,
+}
+
+impl Buster {
+    pub fn init(&self) -> Result<(), Error> {
+        let res = Path::new(&self.result);
+        if res.exists() {
+            fs::remove_dir_all(&self.result).unwrap();
+        }
+
+        fs::create_dir(&self.result).unwrap();
+        self.create_dir_structure(Path::new(&self.source))?;
+        Ok(())
+    }
+
+    fn hasher(payload: &str) -> String {
+        use data_encoding::HEXUPPER;
+        use sha2::{Digest, Sha256};
+        let mut hasher = Sha256::new();
+        hasher.update(payload);
+        HEXUPPER.encode(&hasher.finalize())
+    }
+
+    // if mime types are common, then you shoud be fine using this
+    // use [hash] when when they aren't
+    //
+    // doesn't process files for which mime is not resolved
+    pub fn try_hash(&self) -> Result<HashMap<String, String>, Error> {
+        let mut file_map: HashMap<String, String> = HashMap::default();
+        for entry in WalkDir::new(&self.source)
+            .follow_links(self.follow_links)
+            .into_iter()
+        {
+            let entry = entry?;
+            let path = entry.path();
+            let path = Path::new(&path);
+
+            for mime_type in self.mime_types.iter() {
+                if let Some(file_mime) = mime_guess::from_path(path).first() {
+                    if &file_mime == mime_type {
+                        let contents = Self::read_to_string(&path).unwrap();
+                        let hash = Self::hasher(&contents);
+                        let new_name = format!(
+                            "{}.{}.{}",
+                            path.file_stem().unwrap().to_str().unwrap(),
+                            hash,
+                            path.extension().unwrap().to_str().unwrap()
+                        );
+                        self.copy(path, &new_name);
+
+                        let (source, destination) = self.gen_map(path, &&new_name);
+                        file_map.insert(
+                            source.to_str().unwrap().into(),
+                            destination.to_str().unwrap().into(),
+                        );
+                    }
+                }
+            }
+        }
+
+        Ok(file_map)
+    }
+
+    // panics when mimetypes are detected. This way you'll know which files are ignored
+    // from processing
+    pub fn hash(&self) -> Result<HashMap<String, String>, Error> {
+        let mut file_map: HashMap<String, String> = HashMap::default();
+
+        for entry in WalkDir::new(&self.source)
+            .follow_links(self.follow_links)
+            .into_iter()
+        {
+            let entry = entry?;
+
+            let path = entry.path();
+            if !path.is_dir() {
+                let path = Path::new(&path);
+
+                for mime_type in self.mime_types.iter() {
+                    let file_mime = mime_guess::from_path(path)
+                        .first()
+                        .expect(&format!("couldn't resolve MIME for file: {:?}", &path));
+                    if &file_mime == mime_type {
+                        let contents = Self::read_to_string(&path).unwrap();
+                        let hash = Self::hasher(&contents);
+                        let new_name = format!(
+                            "{}.{}.{}",
+                            path.file_stem().unwrap().to_str().unwrap(),
+                            hash,
+                            path.extension().unwrap().to_str().unwrap()
+                        );
+                        self.copy(path, &new_name);
+                        let (source, destination) = self.gen_map(path, &&new_name);
+                        file_map.insert(
+                            source.to_str().unwrap().into(),
+                            destination.to_str().unwrap().into(),
+                        );
+                    }
+                }
+            }
+        }
+
+        Ok(file_map)
+    }
+
+    fn read_to_string(path: &Path) -> Result<String, Error> {
+        use std::fs::File;
+        use std::io::{BufRead, BufReader};
+
+        let input = File::open(path)?;
+        let buffered = BufReader::new(input);
+
+        let mut res = String::new();
+        for line in buffered.lines() {
+            res.push_str(&line?)
+        }
+
+        Ok(res)
+    }
+
+    fn gen_map<'a>(&self, source: &'a Path, name: &str) -> (&'a Path, PathBuf) {
+        let rel_location = source.strip_prefix(&self.source).unwrap().parent().unwrap();
+        let destination = Path::new(&self.result).join(rel_location).join(name);
+        (source, destination)
+    }
+
+    fn copy(&self, source: &Path, name: &str) {
+        let rel_location = source.strip_prefix(&self.source).unwrap().parent().unwrap();
+        let destination = Path::new(&self.result).join(rel_location).join(name);
+        fs::copy(source, &destination).unwrap();
+    }
+
+    fn create_dir_structure(&self, path: &Path) -> Result<(), Error> {
+        for entry in WalkDir::new(&path)
+            .follow_links(self.follow_links)
+            .into_iter()
+        {
+            let entry = entry?;
+            let entry_path = entry.path();
+            let entry_path = Path::new(&entry_path);
+
+            if entry_path.is_dir() && path != entry_path {
+                Self::create_dir_structure(&self, entry_path)?;
+            } else {
+                if entry_path.is_dir() {
+                    let rel_location = entry_path.strip_prefix(&self.source).unwrap();
+                    let destination = Path::new(&self.result).join(rel_location);
+                    if !destination.exists() {
+                        fs::create_dir(destination)?
+                    }
+                }
+            }
+        }
+        Ok(())
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn hasher_works() {
+        let types = vec![
+            mime::IMAGE_PNG,
+            mime::IMAGE_SVG,
+            mime::IMAGE_JPEG,
+            mime::IMAGE_GIF,
+        ];
+
+        let config = BusterBuilder::default()
+            .source("./dist")
+            .result("./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());
+        }
+    }
+}
+
+
+ \ No newline at end of file diff --git a/src/cache_buster/lib.rs.html b/src/cache_buster/lib.rs.html index 3886926..a1f16a7 100644 --- a/src/cache_buster/lib.rs.html +++ b/src/cache_buster/lib.rs.html @@ -1,197 +1,42 @@ lib.rs - source
  1
-  2
-  3
-  4
-  5
-  6
-  7
-  8
-  9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 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
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
-100
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-121
-122
-123
-124
-125
-126
-127
-128
-129
-130
-131
-132
-133
-134
-135
-136
-137
-138
-139
-140
-141
-142
-143
-144
-145
-146
-147
-148
-149
-150
-151
-152
-153
-154
-155
-156
-157
-158
-159
-160
-161
-162
-163
-164
-165
-166
-167
-168
-169
-170
-171
-172
-173
-174
-175
-176
-177
-178
-179
-180
-181
-182
-183
-184
-185
-186
-187
-188
-189
-190
-191
+                Change settings
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
 
 /*
 * Copyright (C) 2021  Aravinth Manivannan <realaravinth@batsense.net>
@@ -227,163 +72,8 @@
 //! }
 //! ```
 
-use std::fs;
-use std::io::Error;
-use std::path::Path;
-
-use derive_builder::Builder;
-use walkdir::WalkDir;
-
-#[derive(Debug, Clone, Builder)]
-pub struct Buster {
-    // source directory
-    #[builder(setter(into))]
-    source: String,
-    // mime_types for hashing
-    mime_types: Vec<mime::Mime>,
-    // directory for writing results
-    #[builder(setter(into))]
-    result: String,
-    // copy other non-hashed files from source dire to result dir?
-    copy: bool,
-    follow_links: bool,
-}
-
-impl Buster {
-    pub fn init(&self) -> Result<(), Error> {
-        let res = Path::new(&self.result);
-        if res.exists() {
-            fs::remove_dir_all(&self.result).unwrap();
-        }
-
-        fs::create_dir(&self.result).unwrap();
-        self.create_dir_structure(Path::new(&self.source))?;
-        Ok(())
-    }
-
-    fn hasher(payload: &str) -> String {
-        use data_encoding::HEXUPPER;
-        use sha2::{Digest, Sha256};
-        let mut hasher = Sha256::new();
-        hasher.update(payload);
-        HEXUPPER.encode(&hasher.finalize())
-    }
-
-    // if mime types are common, then you shoud be fine using this
-    // use [hash] when when they aren't
-    //
-    // doesn't process files for which mime is not resolved
-    pub fn try_hash(&self) -> Result<(), Error> {
-        for entry in WalkDir::new(&self.source)
-            .follow_links(self.follow_links)
-            .into_iter()
-        {
-            let entry = entry?;
-            let path = entry.path();
-            let path = Path::new(&path);
-
-            for mime_type in self.mime_types.iter() {
-                if let Some(file_mime) = mime_guess::from_path(path).first() {
-                    if &file_mime == mime_type {
-                        let contents = Self::read_to_string(&path).unwrap();
-                        let hash = Self::hasher(&contents);
-                        let new_name = format!(
-                            "{}.{}.{}",
-                            path.file_stem().unwrap().to_str().unwrap(),
-                            hash,
-                            path.extension().unwrap().to_str().unwrap()
-                        );
-                        //                        println!("{}", &new_name);
-                        self.copy(path, &new_name);
-                        //                        let data = fs::copy(path, new_name);
-                    }
-                }
-            }
-        }
-
-        Ok(())
-    }
-
-    // panics when mimetypes are detected. This way you'll know which files are ignored
-    // from processing
-    pub fn hash(&self) -> Result<(), Error> {
-        for entry in WalkDir::new(&self.source)
-            .follow_links(self.follow_links)
-            .into_iter()
-        {
-            let entry = entry?;
-
-            let path = entry.path();
-            if !path.is_dir() {
-                let path = Path::new(&path);
-
-                for mime_type in self.mime_types.iter() {
-                    let file_mime = mime_guess::from_path(path)
-                        .first()
-                        .expect(&format!("couldn't resolve MIME for file: {:?}", &path));
-                    if &file_mime == mime_type {
-                        let contents = Self::read_to_string(&path).unwrap();
-                        let hash = Self::hasher(&contents);
-                        let new_name = format!(
-                            "{}.{}.{}",
-                            path.file_stem().unwrap().to_str().unwrap(),
-                            hash,
-                            path.extension().unwrap().to_str().unwrap()
-                        );
-                        self.copy(path, &new_name);
-                    }
-                }
-            }
-        }
-
-        Ok(())
-    }
-
-    fn read_to_string(path: &Path) -> Result<String, Error> {
-        use std::fs::File;
-        use std::io::{BufRead, BufReader};
-
-        let input = File::open(path)?;
-        let buffered = BufReader::new(input);
-
-        let mut res = String::new();
-        for line in buffered.lines() {
-            res.push_str(&line?)
-        }
-
-        Ok(res)
-    }
-
-    fn copy(&self, source: &Path, name: &str) {
-        let rel_location = source.strip_prefix(&self.source).unwrap().parent().unwrap();
-        let destination = Path::new(&self.result).join(rel_location).join(name);
-        fs::copy(source, &destination).unwrap();
-    }
-
-    fn create_dir_structure(&self, path: &Path) -> Result<(), Error> {
-        for entry in WalkDir::new(&path)
-            .follow_links(self.follow_links)
-            .into_iter()
-        {
-            let entry = entry?;
-            let entry_path = entry.path();
-            let entry_path = Path::new(&entry_path);
-
-            if entry_path.is_dir() && path != entry_path {
-                Self::create_dir_structure(&self, entry_path)?;
-            } else {
-                if entry_path.is_dir() {
-                    let rel_location = entry_path.strip_prefix(&self.source).unwrap();
-                    let destination = Path::new(&self.result).join(rel_location);
-                    if !destination.exists() {
-                        fs::create_dir(destination)?
-                    }
-                }
-            }
-        }
-        Ok(())
-    }
-}
+pub mod hash;
+pub use hash::BusterBuilder;
 
\ No newline at end of file