Skip to content

Commit

Permalink
deploy: 1b62220
Browse files Browse the repository at this point in the history
  • Loading branch information
sosthene-nitrokey committed Dec 16, 2024
1 parent e1ee7f6 commit 6c878de
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 11 deletions.
58 changes: 54 additions & 4 deletions src/trussed/store.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,32 @@
<a href="#640" id="640">640</a>
<a href="#641" id="641">641</a>
<a href="#642" id="642">642</a>
<a href="#643" id="643">643</a></pre></div><pre class="rust"><code><span class="doccomment">//! `store` presents a combined interface to three littlefs2 filesystems:
<a href="#643" id="643">643</a>
<a href="#644" id="644">644</a>
<a href="#645" id="645">645</a>
<a href="#646" id="646">646</a>
<a href="#647" id="647">647</a>
<a href="#648" id="648">648</a>
<a href="#649" id="649">649</a>
<a href="#650" id="650">650</a>
<a href="#651" id="651">651</a>
<a href="#652" id="652">652</a>
<a href="#653" id="653">653</a>
<a href="#654" id="654">654</a>
<a href="#655" id="655">655</a>
<a href="#656" id="656">656</a>
<a href="#657" id="657">657</a>
<a href="#658" id="658">658</a>
<a href="#659" id="659">659</a>
<a href="#660" id="660">660</a>
<a href="#661" id="661">661</a>
<a href="#662" id="662">662</a>
<a href="#663" id="663">663</a>
<a href="#664" id="664">664</a>
<a href="#665" id="665">665</a>
<a href="#666" id="666">666</a>
<a href="#667" id="667">667</a>
<a href="#668" id="668">668</a></pre></div><pre class="rust"><code><span class="doccomment">//! `store` presents a combined interface to three littlefs2 filesystems:
//! internal flash, external flash, volatile/RAM.
//!
//! It covers two usecases:
Expand Down Expand Up @@ -715,7 +740,7 @@
//! - Alternative: subdirectory &lt;==&gt; RP hash, everything else in flat files
//! - In any case need to "list dirs excluding . and .." or similar

</span><span class="kw">use </span>littlefs2::{driver::Storage, fs::Filesystem};
</span><span class="kw">use </span>littlefs2::{driver::Storage, fs::Filesystem, path};

<span class="kw">use </span><span class="kw">crate</span>::error::Error;
<span class="kw">use </span><span class="kw">crate</span>::types::{Bytes, Location};
Expand Down Expand Up @@ -1197,8 +1222,33 @@
<span class="attr">#[inline(never)]
</span><span class="kw">pub fn </span>delete(store: <span class="kw">impl </span>Store, location: Location, path: <span class="kw-2">&amp;</span>Path) -&gt; bool {
<span class="macro">debug_now!</span>(<span class="string">"deleting {}"</span>, <span class="kw-2">&amp;</span>path);
store.fs(location).remove(path).is_ok()
}
<span class="kw">let </span>fs = store.fs(location);
<span class="kw">if </span>fs.remove(path).is_err() {
<span class="kw">return </span><span class="bool-val">false</span>;
}

<span class="comment">// Only delete ancestors for volatile FS
</span><span class="kw">if </span>location != Location::Volatile {
<span class="kw">return </span><span class="bool-val">true</span>;
}
<span class="comment">// first ancestor is the file itself
</span><span class="kw">for </span>parent <span class="kw">in </span>path.ancestors().skip(<span class="number">1</span>) {
<span class="kw">if </span><span class="kw-2">&amp;*</span>parent == <span class="macro">path!</span>(<span class="string">"/"</span>) {
<span class="kw">break</span>;
}
<span class="kw">let </span><span class="prelude-val">Ok</span>(meta) = fs.metadata(<span class="kw-2">&amp;</span>parent) <span class="kw">else </span>{
<span class="kw">return </span><span class="bool-val">false</span>;
};
<span class="kw">if </span>meta.is_dir() &amp;&amp; meta.is_empty() {
<span class="kw">if </span>fs.remove_dir(<span class="kw-2">&amp;</span>parent).is_err() {
<span class="kw">return </span><span class="bool-val">false</span>;
}
} <span class="kw">else </span>{
<span class="kw">break</span>;
}
}
<span class="bool-val">true
</span>}

<span class="attr">#[inline(never)]
</span><span class="kw">pub fn </span>exists(store: <span class="kw">impl </span>Store, location: Location, path: <span class="kw-2">&amp;</span>Path) -&gt; bool {
Expand Down
2 changes: 1 addition & 1 deletion trussed/store/fn.delete.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `delete` fn in crate `trussed`."><title>delete in trussed::store - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b0742ba02757f159.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="trussed" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0 (90b35a623 2024-11-26)" data-channel="1.83.0" data-search-js="search-f0d225181b97f9a4.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-f070b9041d14864c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../trussed/index.html">trussed</a><span class="version">0.1.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In trussed::<wbr>store</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">trussed</a>::<wbr><a href="index.html">store</a></span><h1>Function <span class="fn">delete</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/trussed/store.rs.html#555-558">source</a> </span></div><pre class="rust item-decl"><code>pub fn delete(store: impl <a class="trait" href="trait.Store.html" title="trait trussed::store::Store">Store</a>, location: <a class="enum" href="../types/enum.Location.html" title="enum trussed::types::Location">Location</a>, path: &amp;<a class="struct" href="../types/struct.Path.html" title="struct trussed::types::Path">Path</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.bool.html">bool</a></code></pre></section></div></main></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `delete` fn in crate `trussed`."><title>delete in trussed::store - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b0742ba02757f159.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="trussed" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0 (90b35a623 2024-11-26)" data-channel="1.83.0" data-search-js="search-f0d225181b97f9a4.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-f070b9041d14864c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../trussed/index.html">trussed</a><span class="version">0.1.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In trussed::<wbr>store</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">trussed</a>::<wbr><a href="index.html">store</a></span><h1>Function <span class="fn">delete</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/trussed/store.rs.html#555-583">source</a> </span></div><pre class="rust item-decl"><code>pub fn delete(store: impl <a class="trait" href="trait.Store.html" title="trait trussed::store::Store">Store</a>, location: <a class="enum" href="../types/enum.Location.html" title="enum trussed::types::Location">Location</a>, path: &amp;<a class="struct" href="../types/struct.Path.html" title="struct trussed::types::Path">Path</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.bool.html">bool</a></code></pre></section></div></main></body></html>
2 changes: 1 addition & 1 deletion trussed/store/fn.exists.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `exists` fn in crate `trussed`."><title>exists in trussed::store - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b0742ba02757f159.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="trussed" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0 (90b35a623 2024-11-26)" data-channel="1.83.0" data-search-js="search-f0d225181b97f9a4.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-f070b9041d14864c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../trussed/index.html">trussed</a><span class="version">0.1.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In trussed::<wbr>store</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">trussed</a>::<wbr><a href="index.html">store</a></span><h1>Function <span class="fn">exists</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/trussed/store.rs.html#561-564">source</a> </span></div><pre class="rust item-decl"><code>pub fn exists(store: impl <a class="trait" href="trait.Store.html" title="trait trussed::store::Store">Store</a>, location: <a class="enum" href="../types/enum.Location.html" title="enum trussed::types::Location">Location</a>, path: &amp;<a class="struct" href="../types/struct.Path.html" title="struct trussed::types::Path">Path</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.bool.html">bool</a></code></pre></section></div></main></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `exists` fn in crate `trussed`."><title>exists in trussed::store - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b0742ba02757f159.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="trussed" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0 (90b35a623 2024-11-26)" data-channel="1.83.0" data-search-js="search-f0d225181b97f9a4.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-f070b9041d14864c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../trussed/index.html">trussed</a><span class="version">0.1.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In trussed::<wbr>store</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">trussed</a>::<wbr><a href="index.html">store</a></span><h1>Function <span class="fn">exists</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/trussed/store.rs.html#586-589">source</a> </span></div><pre class="rust item-decl"><code>pub fn exists(store: impl <a class="trait" href="trait.Store.html" title="trait trussed::store::Store">Store</a>, location: <a class="enum" href="../types/enum.Location.html" title="enum trussed::types::Location">Location</a>, path: &amp;<a class="struct" href="../types/struct.Path.html" title="struct trussed::types::Path">Path</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.83.0/core/primitive.bool.html">bool</a></code></pre></section></div></main></body></html>
Loading

0 comments on commit 6c878de

Please sign in to comment.