Deploying to gh-pages from @ 71d5ef67a2
🚀
This commit is contained in:
parent
3d2d693458
commit
396b42042a
4 changed files with 10 additions and 8 deletions
|
@ -10,9 +10,11 @@
|
|||
Fields<a href="#fields" class="anchor"></a></h2><span id="structfield.map" class="structfield small-section-header"><a href="#structfield.map" class="anchor field"></a><code>map: <a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>></code></span><div class="docblock"><p>filemap<original-path, modified-path></p>
|
||||
</div><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><h3 id="impl" class="impl"><code class="in-band">impl <a class="struct" href="../../cache_buster/filemap/struct.Files.html" title="struct cache_buster::filemap::Files">Files</a></code><a href="#impl" class="anchor"></a><a class="srclink" href="../../src/cache_buster/filemap.rs.html#36-98" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a>(base_dir: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> Self</code><a class="srclink" href="../../src/cache_buster/filemap.rs.html#38-43" title="goto source code">[src]</a></h4><div class="docblock"><p>Initialize map</p>
|
||||
</div><h4 id="method.get" class="method"><code>pub fn <a href="#method.get" class="fnname">get</a><'a>(&'a self, path: &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>></code><a class="srclink" href="../../src/cache_buster/filemap.rs.html#49-55" title="goto source code">[src]</a></h4><div class="docblock"><p>Get relative file path</p>
|
||||
<p>If the modified filename path is './prod/test.randomhash.svg<code>, it will output </code>/test.randomhash.svg`. For full path, see [get_full_path]</p>
|
||||
<p>If the modified filename path is <code>./prod/test.randomhash.svg</code>, it will
|
||||
output <code>/test.randomhash.svg</code>. For full path, see <a href="../../cache_buster/filemap/struct.Files.html#method.get_full_path" title="Self::get_full_path">get_full_path</a>.</p>
|
||||
</div><h4 id="method.get_full_path" class="method"><code>pub fn <a href="#method.get_full_path" class="fnname">get_full_path</a><'a>(&'a self, path: &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&'a <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>></code><a class="srclink" href="../../src/cache_buster/filemap.rs.html#61-63" title="goto source code">[src]</a></h4><div class="docblock"><p>Get file path</p>
|
||||
<p>If the modified filename path is './prod/test.randomhash.svg<code>, it will output </code>/prod/test.randomhash.svg`. For relative path, see [get]</p>
|
||||
<p>If the modified filename path is <code>./prod/test.randomhash.svg</code>, it will
|
||||
output <code>/prod/test.randomhash.svg</code>. For relative path, see <a href="../../cache_buster/filemap/struct.Files.html#method.get" title="Self::get">get</a>.</p>
|
||||
</div><h4 id="method.add" class="method"><code>pub fn <a href="#method.add" class="fnname">add</a>(&mut self, k: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, v: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, &'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>></code><a class="srclink" href="../../src/cache_buster/filemap.rs.html#66-73" title="goto source code">[src]</a></h4><div class="docblock"><p>Create file map: map original path to modified paths</p>
|
||||
</div><h4 id="method.to_env" class="method"><code>pub fn <a href="#method.to_env" class="fnname">to_env</a>(&self)</code><a class="srclink" href="../../src/cache_buster/filemap.rs.html#77-89" title="goto source code">[src]</a></h4><div class="docblock"><p>This crate uses compile-time environment variables to transfer
|
||||
data to the main program. This funtction sets that variable</p>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</div><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><h3 id="impl" class="impl"><code class="in-band">impl <a class="struct" href="../../cache_buster/processor/struct.Buster.html" title="struct cache_buster::processor::Buster">Buster</a></code><a href="#impl" class="anchor"></a><a class="srclink" href="../../src/cache_buster/processor.rs.html#67-230" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.try_process" class="method"><code>pub fn <a href="#method.try_process" class="fnname">try_process</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="../../cache_buster/filemap/struct.Files.html" title="struct cache_buster::filemap::Files">Files</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></code><a class="srclink" href="../../src/cache_buster/processor.rs.html#96-131" title="goto source code">[src]</a></h4><div class="docblock"><p>Processes files.</p>
|
||||
<p>If MIME types are uncommon, then use this funtion
|
||||
as it won't panic when a weird MIM is encountered.</p>
|
||||
<p>Otherwise, use [process]</p>
|
||||
<p>Otherwise, use <a href="../../cache_buster/processor/struct.Buster.html#method.process" title="Self::process">process</a></p>
|
||||
<p>Note: it omits processing uncommon MIME types</p>
|
||||
</div><h4 id="method.process" class="method"><code>pub fn <a href="#method.process" class="fnname">process</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="../../cache_buster/filemap/struct.Files.html" title="struct cache_buster::filemap::Files">Files</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></code><a class="srclink" href="../../src/cache_buster/processor.rs.html#137-179" title="goto source code">[src]</a></h4><div class="docblock"><p>Processes files.</p>
|
||||
<p>If MIME types are common, then use this funtion
|
||||
|
|
|
@ -263,8 +263,8 @@
|
|||
|
||||
<span class="doccomment">/// Get relative file path</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// If the modified filename path is './prod/test.randomhash.svg`, it will</span>
|
||||
<span class="doccomment">/// output `/test.randomhash.svg`. For full path, see [get_full_path]</span>
|
||||
<span class="doccomment">/// If the modified filename path is `./prod/test.randomhash.svg`, it will</span>
|
||||
<span class="doccomment">/// output `/test.randomhash.svg`. For full path, see [get_full_path][Self::get_full_path].</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">get</span><span class="op"><</span><span class="lifetime">'a</span><span class="op">></span>(<span class="kw-2">&</span><span class="lifetime">'a</span> <span class="self">self</span>, <span class="ident">path</span>: <span class="kw-2">&</span><span class="lifetime">'a</span> <span class="ident">str</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="kw-2">&</span><span class="lifetime">'a</span> <span class="ident">str</span><span class="op">></span> {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">path</span>) <span class="op">=</span> <span class="self">self</span>.<span class="ident">map</span>.<span class="ident">get</span>(<span class="ident">path</span>) {
|
||||
<span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="ident">path</span>[<span class="self">self</span>.<span class="ident">base_dir</span>.<span class="ident">len</span>()..])
|
||||
|
@ -275,8 +275,8 @@
|
|||
|
||||
<span class="doccomment">/// Get file path</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// If the modified filename path is './prod/test.randomhash.svg`, it will</span>
|
||||
<span class="doccomment">/// output `/prod/test.randomhash.svg`. For relative path, see [get]</span>
|
||||
<span class="doccomment">/// If the modified filename path is `./prod/test.randomhash.svg`, it will</span>
|
||||
<span class="doccomment">/// output `/prod/test.randomhash.svg`. For relative path, see [get][Self::get].</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">get_full_path</span><span class="op"><</span><span class="lifetime">'a</span><span class="op">></span>(<span class="kw-2">&</span><span class="lifetime">'a</span> <span class="self">self</span>, <span class="ident">path</span>: <span class="kw-2">&</span><span class="lifetime">'a</span> <span class="ident">str</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="kw-2">&</span><span class="lifetime">'a</span> <span class="ident">String</span><span class="op">></span> {
|
||||
<span class="self">self</span>.<span class="ident">map</span>.<span class="ident">get</span>(<span class="ident">path</span>)
|
||||
}
|
||||
|
|
|
@ -392,7 +392,7 @@
|
|||
<span class="doccomment">/// If MIME types are uncommon, then use this funtion</span>
|
||||
<span class="doccomment">/// as it won't panic when a weird MIM is encountered.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// Otherwise, use [process]</span>
|
||||
<span class="doccomment">/// Otherwise, use [process][Self::process]</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// Note: it omits processing uncommon MIME types</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">try_process</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">Files</span>, <span class="ident">Error</span><span class="op">></span> {
|
||||
|
|
Loading…
Reference in a new issue