mirror of
https://github.com/mii443/merkle.rs.git
synced 2025-08-22 16:05:30 +00:00
Update documentation.
This commit is contained in:
@ -1,10 +0,0 @@
|
||||
(function() {var implementors = {};
|
||||
implementors["merkle"] = ["impl<T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html' title='core::cmp::PartialEq'>PartialEq</a>> <a class='trait' href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html' title='core::cmp::PartialEq'>PartialEq</a> for <a class='enum' href='merkle/enum.Positioned.html' title='merkle::Positioned'>Positioned</a><T>",];
|
||||
|
||||
if (window.register_implementors) {
|
||||
window.register_implementors(implementors);
|
||||
} else {
|
||||
window.pending_implementors = implementors;
|
||||
}
|
||||
|
||||
})()
|
@ -1,10 +0,0 @@
|
||||
(function() {var implementors = {};
|
||||
implementors["merkle"] = [];
|
||||
|
||||
if (window.register_implementors) {
|
||||
window.register_implementors(implementors);
|
||||
} else {
|
||||
window.pending_implementors = implementors;
|
||||
}
|
||||
|
||||
})()
|
@ -26,7 +26,7 @@ h1.fqn {
|
||||
h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) {
|
||||
border-bottom-color: #DDDDDD;
|
||||
}
|
||||
.in-band {
|
||||
.in-band, code {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ div.stability > em > code {
|
||||
background-color: initial;
|
||||
}
|
||||
|
||||
.docblock code, .docblock-short code {
|
||||
.docblock code {
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
pre {
|
||||
@ -107,13 +107,13 @@ nav.main .current {
|
||||
border-bottom-color: #000;
|
||||
}
|
||||
nav.main .separator {
|
||||
border: 1px solid #000;
|
||||
border-color: 1px solid #000;
|
||||
}
|
||||
a {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.docblock a, .docblock-short a, .stability a {
|
||||
.docblock a, .stability a {
|
||||
color: #3873AD;
|
||||
}
|
||||
|
||||
|
16
docs/main.js
16
docs/main.js
@ -34,8 +34,7 @@
|
||||
"primitive",
|
||||
"associatedtype",
|
||||
"constant",
|
||||
"associatedconstant",
|
||||
"union"];
|
||||
"associatedconstant"];
|
||||
|
||||
// used for special search precedence
|
||||
var TY_PRIMITIVE = itemTypes.indexOf("primitive");
|
||||
@ -578,6 +577,10 @@
|
||||
displayPath = item.path + '::';
|
||||
href = rootPath + item.path.replace(/::/g, '/') + '/' +
|
||||
name + '/index.html';
|
||||
} else if (type === 'static' || type === 'reexport') {
|
||||
displayPath = item.path + '::';
|
||||
href = rootPath + item.path.replace(/::/g, '/') +
|
||||
'/index.html';
|
||||
} else if (type === "primitive") {
|
||||
displayPath = "";
|
||||
href = rootPath + item.path.replace(/::/g, '/') +
|
||||
@ -588,14 +591,9 @@
|
||||
} else if (item.parent !== undefined) {
|
||||
var myparent = item.parent;
|
||||
var anchor = '#' + type + '.' + name;
|
||||
var parentType = itemTypes[myparent.ty];
|
||||
if (parentType === "primitive") {
|
||||
displayPath = myparent.name + '::';
|
||||
} else {
|
||||
displayPath = item.path + '::' + myparent.name + '::';
|
||||
}
|
||||
displayPath = item.path + '::' + myparent.name + '::';
|
||||
href = rootPath + item.path.replace(/::/g, '/') +
|
||||
'/' + parentType +
|
||||
'/' + itemTypes[myparent.ty] +
|
||||
'.' + myparent.name +
|
||||
'.html' + anchor;
|
||||
} else {
|
||||
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=trait.MerkleDigest.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="trait.MerkleDigest.html">trait.MerkleDigest.html</a>...</p>
|
||||
<script>location.replace("trait.MerkleDigest.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=struct.MerkleTree.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="struct.MerkleTree.html">struct.MerkleTree.html</a>...</p>
|
||||
<script>location.replace("struct.MerkleTree.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=enum.Positioned.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="enum.Positioned.html">enum.Positioned.html</a>...</p>
|
||||
<script>location.replace("enum.Positioned.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=struct.Proof.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="struct.Proof.html">struct.Proof.html</a>...</p>
|
||||
<script>location.replace("struct.Proof.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=struct.ProofBlock.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="struct.ProofBlock.html">struct.ProofBlock.html</a>...</p>
|
||||
<script>location.replace("struct.ProofBlock.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1,126 +0,0 @@
|
||||
<!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 `Positioned` enum in crate `merkle`.">
|
||||
<meta name="keywords" content="rust, rustlang, rust-lang, Positioned">
|
||||
|
||||
<title>merkle::Positioned - Rust</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../rustdoc.css">
|
||||
<link rel="stylesheet" type="text/css" href="../main.css">
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body class="rustdoc">
|
||||
<!--[if lte IE 8]>
|
||||
<div class="warning">
|
||||
This old browser is unsupported and will most likely display funky
|
||||
things.
|
||||
</div>
|
||||
<![endif]-->
|
||||
|
||||
|
||||
|
||||
<nav class="sidebar">
|
||||
|
||||
<p class='location'><a href='index.html'>merkle</a></p><script>window.sidebarCurrent = {name: 'Positioned', ty: 'enum', relpath: ''};</script><script defer src="sidebar-items.js"></script>
|
||||
</nav>
|
||||
|
||||
<nav class="sub">
|
||||
<form class="search-form js-only">
|
||||
<div class="search-container">
|
||||
<input class="search-input" name="search"
|
||||
autocomplete="off"
|
||||
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
|
||||
type="search">
|
||||
</div>
|
||||
</form>
|
||||
</nav>
|
||||
|
||||
<section id='main' class="content enum">
|
||||
<h1 class='fqn'><span class='in-band'>Enum <a href='index.html'>merkle</a>::<wbr><a class='enum' href=''>Positioned</a></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
|
||||
[<span class='inner'>−</span>]
|
||||
</a>
|
||||
</span><a id='src-158' class='srclink' href='../src/merkle/src/proof.rs.html#121-131' title='goto source code'>[src]</a></span></h1>
|
||||
<pre class='rust enum'>pub enum Positioned<T> {
|
||||
Nowhere,
|
||||
Left(T),
|
||||
Right(T),
|
||||
}</pre><div class='docblock'><p>Tags a value so that we know from in branch (if any) it was found.</p>
|
||||
</div><h2 class='variants'>Variants</h2>
|
||||
<span id='variant.Nowhere' class='variant'><span id='Nowhere.v' class='invisible'><code>Nowhere</code></span></span><div class='docblock'><p>No value was found</p>
|
||||
</div><span id='variant.Left' class='variant'><span id='Left.v' class='invisible'><code>Left(T)</code></span></span><div class='docblock'><p>The value was found in the left branch</p>
|
||||
</div><span id='variant.Right' class='variant'><span id='Right.v' class='invisible'><code>Right(T)</code></span></span><div class='docblock'><p>The value was found in the right branch</p>
|
||||
</div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><span class='in-band'><code>impl<T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html' title='core::cmp::PartialEq'>PartialEq</a>> <a class='trait' href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html' title='core::cmp::PartialEq'>PartialEq</a> for <a class='enum' href='../merkle/enum.Positioned.html' title='merkle::Positioned'>Positioned</a><T></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-165' class='srclink' href='../src/merkle/src/proof.rs.html#120' title='goto source code'>[src]</a></span></h3>
|
||||
<div class='impl-items'><h4 id='method.eq' class='method'><span id='eq.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, __arg_0: &<a class='enum' href='../merkle/enum.Positioned.html' title='merkle::Positioned'>Positioned</a><T>) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></span></h4>
|
||||
<div class='docblock'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
|
||||
</div><h4 id='method.ne' class='method'><span id='ne.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, __arg_0: &<a class='enum' href='../merkle/enum.Positioned.html' title='merkle::Positioned'>Positioned</a><T>) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></span></h4>
|
||||
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
|
||||
</div></div></section>
|
||||
<section id='search' class="content hidden"></section>
|
||||
|
||||
<section class="footer"></section>
|
||||
|
||||
<aside id="help" class="hidden">
|
||||
<div>
|
||||
<h1 class="hidden">Help</h1>
|
||||
|
||||
<div class="shortcuts">
|
||||
<h2>Keyboard Shortcuts</h2>
|
||||
|
||||
<dl>
|
||||
<dt>?</dt>
|
||||
<dd>Show this help dialog</dd>
|
||||
<dt>S</dt>
|
||||
<dd>Focus the search field</dd>
|
||||
<dt>⇤</dt>
|
||||
<dd>Move up in search results</dd>
|
||||
<dt>⇥</dt>
|
||||
<dd>Move down in search results</dd>
|
||||
<dt>⏎</dt>
|
||||
<dd>Go to active search result</dd>
|
||||
<dt>+</dt>
|
||||
<dd>Collapse/expand all sections</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="infos">
|
||||
<h2>Search Tricks</h2>
|
||||
|
||||
<p>
|
||||
Prefix searches with a type followed by a colon (e.g.
|
||||
<code>fn:</code>) to restrict the search to a given type.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Accepted types are: <code>fn</code>, <code>mod</code>,
|
||||
<code>struct</code>, <code>enum</code>,
|
||||
<code>trait</code>, <code>type</code>, <code>macro</code>,
|
||||
and <code>const</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Search functions by type signature (e.g.
|
||||
<code>vec -> usize</code> or <code>* -> vec</code>)
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
window.rootPath = "../";
|
||||
window.currentCrate = "merkle";
|
||||
</script>
|
||||
<script src="../jquery.js"></script>
|
||||
<script src="../main.js"></script>
|
||||
<script defer src="../search-index.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -47,14 +47,14 @@
|
||||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
|
||||
[<span class='inner'>−</span>]
|
||||
</a>
|
||||
</span><a id='src-0' class='srclink' href='../src/merkle/src/lib.rs.html#2-18' title='goto source code'>[src]</a></span></h1>
|
||||
</span><a id='src-0' class='srclink' href='../src/merkle/src/lib.rs.html#2-17' title='goto source code'>[src]</a></span></h1>
|
||||
<div class='docblock'><p><em>merkle</em> implements a Merkle Tree in Rust.</p>
|
||||
</div><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
|
||||
<table>
|
||||
<tr class=' module-item'>
|
||||
<td><a class='struct' href='struct.MerkleTree.html'
|
||||
title='merkle::MerkleTree'>MerkleTree</a></td>
|
||||
<td class='docblock-short'>
|
||||
<td class='docblock short'>
|
||||
<p>A Merkle tree is a binary tree, with values of type <code>T</code> at the leafs,
|
||||
and where every node holds the hash of the concatenation of the hashes of
|
||||
its children nodes.</p>
|
||||
@ -63,36 +63,9 @@ its children nodes.</p>
|
||||
<tr class=' module-item'>
|
||||
<td><a class='struct' href='struct.Proof.html'
|
||||
title='merkle::Proof'>Proof</a></td>
|
||||
<td class='docblock-short'>
|
||||
<p>An inclusion proof represent the fact that <code>value</code> is a member of a <code>MerkleTree</code>
|
||||
with root hash <code>root_hash</code>, and hash function <code>digest</code>.
|
||||
A proof is a linked-list of <code>ProofBlock</code>s.
|
||||
TODO: Represent a proof as a vector of ProofBlock instead of a linked-list?</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class=' module-item'>
|
||||
<td><a class='struct' href='struct.ProofBlock.html'
|
||||
title='merkle::ProofBlock'>ProofBlock</a></td>
|
||||
<td class='docblock-short'>
|
||||
<p>A <code>ProofBlock</code> is a linked-list holding the hash of the node, the hash of its sibling node,
|
||||
and the rest of the inclusion proof.</p>
|
||||
</td>
|
||||
</tr></table><h2 id='enums' class='section-header'><a href="#enums">Enums</a></h2>
|
||||
<table>
|
||||
<tr class=' module-item'>
|
||||
<td><a class='enum' href='enum.Positioned.html'
|
||||
title='merkle::Positioned'>Positioned</a></td>
|
||||
<td class='docblock-short'>
|
||||
<p>Tags a value so that we know from in branch (if any) it was found.</p>
|
||||
</td>
|
||||
</tr></table><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
|
||||
<table>
|
||||
<tr class=' module-item'>
|
||||
<td><a class='trait' href='trait.MerkleDigest.html'
|
||||
title='merkle::MerkleDigest'>MerkleDigest</a></td>
|
||||
<td class='docblock-short'>
|
||||
<p>The sole purpose of this trait is to extend the standard
|
||||
<code>crypto::digest::Digest</code> with a couple utility functions.</p>
|
||||
<td class='docblock short'>
|
||||
<p>An inclusion proof represent the fact that a <code>value</code> is a member
|
||||
of a <code>MerkleTree</code> with root hash <code>root_hash</code>, and hash function <code>digest</code>.</p>
|
||||
</td>
|
||||
</tr></table></section>
|
||||
<section id='search' class="content hidden"></section>
|
||||
@ -150,9 +123,11 @@ and the rest of the inclusion proof.</p>
|
||||
<script>
|
||||
window.rootPath = "../";
|
||||
window.currentCrate = "merkle";
|
||||
window.playgroundUrl = "";
|
||||
</script>
|
||||
<script src="../jquery.js"></script>
|
||||
<script src="../main.js"></script>
|
||||
|
||||
<script defer src="../search-index.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=trait.MerkleDigest.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="trait.MerkleDigest.html">trait.MerkleDigest.html</a>...</p>
|
||||
<script>location.replace("trait.MerkleDigest.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../merkle/trait.MerkleDigest.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../merkle/trait.MerkleDigest.html">../../merkle/trait.MerkleDigest.html</a>...</p>
|
||||
<script>location.replace("../../merkle/trait.MerkleDigest.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=struct.MerkleTree.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="struct.MerkleTree.html">struct.MerkleTree.html</a>...</p>
|
||||
<script>location.replace("struct.MerkleTree.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=struct.Proof.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="struct.Proof.html">struct.Proof.html</a>...</p>
|
||||
<script>location.replace("struct.Proof.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=struct.ProofBlock.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="struct.ProofBlock.html">struct.ProofBlock.html</a>...</p>
|
||||
<script>location.replace("struct.ProofBlock.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../merkle/struct.ProofBlock.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../merkle/struct.ProofBlock.html">../../merkle/struct.ProofBlock.html</a>...</p>
|
||||
<script>location.replace("../../merkle/struct.ProofBlock.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=enum.Positioned.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="enum.Positioned.html">enum.Positioned.html</a>...</p>
|
||||
<script>location.replace("enum.Positioned.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=struct.Proof.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="struct.Proof.html">struct.Proof.html</a>...</p>
|
||||
<script>location.replace("struct.Proof.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=struct.ProofBlock.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="struct.ProofBlock.html">struct.ProofBlock.html</a>...</p>
|
||||
<script>location.replace("struct.ProofBlock.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../merkle/enum.Positioned.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../merkle/enum.Positioned.html">../../merkle/enum.Positioned.html</a>...</p>
|
||||
<script>location.replace("../../merkle/enum.Positioned.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../merkle/struct.ProofBlock.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../merkle/struct.ProofBlock.html">../../merkle/struct.ProofBlock.html</a>...</p>
|
||||
<script>location.replace("../../merkle/struct.ProofBlock.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1 +1 @@
|
||||
initSidebarItems({"enum":[["Positioned","Tags a value so that we know from in branch (if any) it was found."]],"struct":[["MerkleTree","A Merkle tree is a binary tree, with values of type `T` at the leafs, and where every node holds the hash of the concatenation of the hashes of its children nodes."],["Proof","An inclusion proof represent the fact that `value` is a member of a `MerkleTree` with root hash `root_hash`, and hash function `digest`. A proof is a linked-list of `ProofBlock`s. TODO: Represent a proof as a vector of ProofBlock instead of a linked-list?"],["ProofBlock","A `ProofBlock` is a linked-list holding the hash of the node, the hash of its sibling node, and the rest of the inclusion proof."]],"trait":[["MerkleDigest","The sole purpose of this trait is to extend the standard `crypto::digest::Digest` with a couple utility functions."]]});
|
||||
initSidebarItems({"struct":[["MerkleTree","A Merkle tree is a binary tree, with values of type `T` at the leafs, and where every node holds the hash of the concatenation of the hashes of its children nodes."],["Proof","An inclusion proof represent the fact that a `value` is a member of a `MerkleTree` with root hash `root_hash`, and hash function `digest`."]]});
|
@ -48,7 +48,7 @@
|
||||
[<span class='inner'>−</span>]
|
||||
</a>
|
||||
</span><a id='src-10' class='srclink' href='../src/merkle/src/merkletree.rs.html#14-26' title='goto source code'>[src]</a></span></h1>
|
||||
<pre class='rust struct'>pub struct MerkleTree<D, T> {
|
||||
<pre class='rust struct'>pub struct MerkleTree<D, T> {
|
||||
pub digest: D,
|
||||
pub tree: Tree<T>,
|
||||
pub height: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a>,
|
||||
@ -56,28 +56,20 @@
|
||||
}</pre><div class='docblock'><p>A Merkle tree is a binary tree, with values of type <code>T</code> at the leafs,
|
||||
and where every node holds the hash of the concatenation of the hashes of
|
||||
its children nodes.</p>
|
||||
</div><h2 class='fields'>Fields</h2><span id='structfield.digest' class='structfield'>
|
||||
<span id='digest.v' class='invisible'>
|
||||
<code>digest: D</code>
|
||||
</span></span><span class='stab '></span><div class='docblock'><p>The hashing function used by this Merkle tree</p>
|
||||
</div><span id='structfield.tree' class='structfield'>
|
||||
<span id='tree.v' class='invisible'>
|
||||
<code>tree: Tree<T></code>
|
||||
</span></span><span class='stab '></span><div class='docblock'><p>The inner binary tree</p>
|
||||
</div><span id='structfield.height' class='structfield'>
|
||||
<span id='height.v' class='invisible'>
|
||||
<code>height: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a></code>
|
||||
</span></span><span class='stab '></span><div class='docblock'><p>The height of the tree</p>
|
||||
</div><span id='structfield.count' class='structfield'>
|
||||
<span id='count.v' class='invisible'>
|
||||
<code>count: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a></code>
|
||||
</span></span><span class='stab '></span><div class='docblock'><p>The number of leaf nodes in the tree</p>
|
||||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl<D, T> <a class='struct' href='../merkle/struct.MerkleTree.html' title='merkle::MerkleTree'>MerkleTree</a><D, T> <span class='where'>where D: Digest + <a class='trait' href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a>, T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/convert/trait.Into.html' title='core::convert::Into'>Into</a><<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>> + <a class='trait' href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a></span></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-17' class='srclink' href='../src/merkle/src/merkletree.rs.html#28-109' title='goto source code'>[src]</a></span></h3>
|
||||
<div class='impl-items'><h4 id='method.from_vec' class='method'><span id='from_vec.v' class='invisible'><code>fn <a href='#method.from_vec' class='fnname'>from_vec</a>(digest: D, values: <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><T>) -> Self</code></span></h4>
|
||||
</div><h2 class='fields'>Fields</h2><span id='structfield.digest' class='structfield'><code>digest: D</code>
|
||||
</span><span class='stab '></span><div class='docblock'><p>The hashing function used by this Merkle tree</p>
|
||||
</div><span id='structfield.tree' class='structfield'><code>tree: Tree<T></code>
|
||||
</span><span class='stab '></span><div class='docblock'><p>The inner binary tree</p>
|
||||
</div><span id='structfield.height' class='structfield'><code>height: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a></code>
|
||||
</span><span class='stab '></span><div class='docblock'><p>The height of the tree</p>
|
||||
</div><span id='structfield.count' class='structfield'><code>count: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a></code>
|
||||
</span><span class='stab '></span><div class='docblock'><p>The number of leaf nodes in the tree</p>
|
||||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl<D, T> <a class='struct' href='../merkle/struct.MerkleTree.html' title='merkle::MerkleTree'>MerkleTree</a><D, T> <span class='where'>where D: Digest + <a class='trait' href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a>, T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/convert/trait.Into.html' title='core::convert::Into'>Into</a><<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>> + <a class='trait' href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a></span></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-17' class='srclink' href='../src/merkle/src/merkletree.rs.html#28-109' title='goto source code'>[src]</a></span></h3>
|
||||
<div class='impl-items'><h4 id='method.from_vec' class='method'><code>fn <a href='#method.from_vec' class='fnname'>from_vec</a>(digest: D, values: <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><T>) -> Self</code></h4>
|
||||
<div class='docblock'><p>Constructs a Merkle Tree from a vector of data blocks</p>
|
||||
</div><h4 id='method.root_hash' class='method'><span id='root_hash.v' class='invisible'><code>fn <a href='#method.root_hash' class='fnname'>root_hash</a>(&self) -> &<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>></code></span></h4>
|
||||
</div><h4 id='method.root_hash' class='method'><code>fn <a href='#method.root_hash' class='fnname'>root_hash</a>(&self) -> &<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>></code></h4>
|
||||
<div class='docblock'><p>Returns the tree's root hash</p>
|
||||
</div><h4 id='method.gen_proof' class='method'><span id='gen_proof.v' class='invisible'><code>fn <a href='#method.gen_proof' class='fnname'>gen_proof</a>(&self, value: &T) -> <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='struct' href='../merkle/struct.Proof.html' title='merkle::Proof'>Proof</a><D, T>></code></span></h4>
|
||||
</div><h4 id='method.gen_proof' class='method'><code>fn <a href='#method.gen_proof' class='fnname'>gen_proof</a>(&self, value: &T) -> <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='struct' href='../merkle/struct.Proof.html' title='merkle::Proof'>Proof</a><D, T>></code></h4>
|
||||
<div class='docblock'><p>Generate an inclusion proof for the given value.
|
||||
<code>None</code> is returned if the given value is not found in the tree.</p>
|
||||
</div></div></section>
|
||||
@ -136,9 +128,11 @@ its children nodes.</p>
|
||||
<script>
|
||||
window.rootPath = "../";
|
||||
window.currentCrate = "merkle";
|
||||
window.playgroundUrl = "";
|
||||
</script>
|
||||
<script src="../jquery.js"></script>
|
||||
<script src="../main.js"></script>
|
||||
|
||||
<script defer src="../search-index.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -47,31 +47,21 @@
|
||||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
|
||||
[<span class='inner'>−</span>]
|
||||
</a>
|
||||
</span><a id='src-48' class='srclink' href='../src/merkle/src/proof.rs.html#11-16' title='goto source code'>[src]</a></span></h1>
|
||||
<pre class='rust struct'>pub struct Proof<D, T> {
|
||||
</span><a id='src-50' class='srclink' href='../src/merkle/src/proof.rs.html#9-14' title='goto source code'>[src]</a></span></h1>
|
||||
<pre class='rust struct'>pub struct Proof<D, T> {
|
||||
pub digest: D,
|
||||
pub root_hash: <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>,
|
||||
pub block: <a class='struct' href='../merkle/struct.ProofBlock.html' title='merkle::ProofBlock'>ProofBlock</a>,
|
||||
pub block: ProofBlock,
|
||||
pub value: T,
|
||||
}</pre><div class='docblock'><p>An inclusion proof represent the fact that <code>value</code> is a member of a <code>MerkleTree</code>
|
||||
with root hash <code>root_hash</code>, and hash function <code>digest</code>.
|
||||
A proof is a linked-list of <code>ProofBlock</code>s.
|
||||
TODO: Represent a proof as a vector of ProofBlock instead of a linked-list?</p>
|
||||
</div><h2 class='fields'>Fields</h2><span id='structfield.digest' class='structfield'>
|
||||
<span id='digest.v' class='invisible'>
|
||||
<code>digest: D</code>
|
||||
</span></span><span class='stab '></span><span id='structfield.root_hash' class='structfield'>
|
||||
<span id='root_hash.v' class='invisible'>
|
||||
<code>root_hash: <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>></code>
|
||||
</span></span><span class='stab '></span><span id='structfield.block' class='structfield'>
|
||||
<span id='block.v' class='invisible'>
|
||||
<code>block: <a class='struct' href='../merkle/struct.ProofBlock.html' title='merkle::ProofBlock'>ProofBlock</a></code>
|
||||
</span></span><span class='stab '></span><span id='structfield.value' class='structfield'>
|
||||
<span id='value.v' class='invisible'>
|
||||
<code>value: T</code>
|
||||
</span></span><span class='stab '></span><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl<D, T> <a class='struct' href='../merkle/struct.Proof.html' title='merkle::Proof'>Proof</a><D, T> <span class='where'>where D: Digest + <a class='trait' href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a>, T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/convert/trait.Into.html' title='core::convert::Into'>Into</a><<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>> + <a class='trait' href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a></span></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-55' class='srclink' href='../src/merkle/src/proof.rs.html#18-53' title='goto source code'>[src]</a></span></h3>
|
||||
<div class='impl-items'><h4 id='method.validate' class='method'><span id='validate.v' class='invisible'><code>fn <a href='#method.validate' class='fnname'>validate</a>(&self, root_hash: &<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></span></h4>
|
||||
<h4 id='method.validate_block' class='method'><span id='validate_block.v' class='invisible'><code>fn <a href='#method.validate_block' class='fnname'>validate_block</a>(&self, block: &<a class='struct' href='../merkle/struct.ProofBlock.html' title='merkle::ProofBlock'>ProofBlock</a>, digest: &mut D) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></span></h4>
|
||||
}</pre><div class='docblock'><p>An inclusion proof represent the fact that a <code>value</code> is a member
|
||||
of a <code>MerkleTree</code> with root hash <code>root_hash</code>, and hash function <code>digest</code>.</p>
|
||||
</div><h2 class='fields'>Fields</h2><span id='structfield.digest' class='structfield'><code>digest: D</code>
|
||||
</span><span class='stab '></span><span id='structfield.root_hash' class='structfield'><code>root_hash: <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>></code>
|
||||
</span><span class='stab '></span><span id='structfield.block' class='structfield'><code>block: ProofBlock</code>
|
||||
</span><span class='stab '></span><span id='structfield.value' class='structfield'><code>value: T</code>
|
||||
</span><span class='stab '></span><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl<D, T> <a class='struct' href='../merkle/struct.Proof.html' title='merkle::Proof'>Proof</a><D, T> <span class='where'>where D: Digest + <a class='trait' href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a>, T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/convert/trait.Into.html' title='core::convert::Into'>Into</a><<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>> + <a class='trait' href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a></span></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-57' class='srclink' href='../src/merkle/src/proof.rs.html#16-51' title='goto source code'>[src]</a></span></h3>
|
||||
<div class='impl-items'><h4 id='method.validate' class='method'><code>fn <a href='#method.validate' class='fnname'>validate</a>(&self, root_hash: &<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4>
|
||||
<h4 id='method.validate_block' class='method'><code>fn <a href='#method.validate_block' class='fnname'>validate_block</a>(&self, block: &ProofBlock, digest: &mut D) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4>
|
||||
</div></section>
|
||||
<section id='search' class="content hidden"></section>
|
||||
|
||||
@ -128,9 +118,11 @@ TODO: Represent a proof as a vector of ProofBlock instead of a linked-list?</p>
|
||||
<script>
|
||||
window.rootPath = "../";
|
||||
window.currentCrate = "merkle";
|
||||
window.playgroundUrl = "";
|
||||
</script>
|
||||
<script src="../jquery.js"></script>
|
||||
<script src="../main.js"></script>
|
||||
|
||||
<script defer src="../search-index.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,130 +0,0 @@
|
||||
<!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 `ProofBlock` struct in crate `merkle`.">
|
||||
<meta name="keywords" content="rust, rustlang, rust-lang, ProofBlock">
|
||||
|
||||
<title>merkle::ProofBlock - Rust</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../rustdoc.css">
|
||||
<link rel="stylesheet" type="text/css" href="../main.css">
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body class="rustdoc">
|
||||
<!--[if lte IE 8]>
|
||||
<div class="warning">
|
||||
This old browser is unsupported and will most likely display funky
|
||||
things.
|
||||
</div>
|
||||
<![endif]-->
|
||||
|
||||
|
||||
|
||||
<nav class="sidebar">
|
||||
|
||||
<p class='location'><a href='index.html'>merkle</a></p><script>window.sidebarCurrent = {name: 'ProofBlock', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
|
||||
</nav>
|
||||
|
||||
<nav class="sub">
|
||||
<form class="search-form js-only">
|
||||
<div class="search-container">
|
||||
<input class="search-input" name="search"
|
||||
autocomplete="off"
|
||||
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
|
||||
type="search">
|
||||
</div>
|
||||
</form>
|
||||
</nav>
|
||||
|
||||
<section id='main' class="content struct">
|
||||
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>merkle</a>::<wbr><a class='struct' href=''>ProofBlock</a></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
|
||||
[<span class='inner'>−</span>]
|
||||
</a>
|
||||
</span><a id='src-71' class='srclink' href='../src/merkle/src/proof.rs.html#58-62' title='goto source code'>[src]</a></span></h1>
|
||||
<pre class='rust struct'>pub struct ProofBlock {
|
||||
pub node_hash: <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>,
|
||||
pub sibling_hash: <a class='enum' href='../merkle/enum.Positioned.html' title='merkle::Positioned'>Positioned</a><<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>>,
|
||||
pub sub_proof: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='struct' href='https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html' title='alloc::boxed::Box'>Box</a><<a class='struct' href='../merkle/struct.ProofBlock.html' title='merkle::ProofBlock'>ProofBlock</a>>>,
|
||||
}</pre><div class='docblock'><p>A <code>ProofBlock</code> is a linked-list holding the hash of the node, the hash of its sibling node,
|
||||
and the rest of the inclusion proof.</p>
|
||||
</div><h2 class='fields'>Fields</h2><span id='structfield.node_hash' class='structfield'>
|
||||
<span id='node_hash.v' class='invisible'>
|
||||
<code>node_hash: <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>></code>
|
||||
</span></span><span class='stab '></span><span id='structfield.sibling_hash' class='structfield'>
|
||||
<span id='sibling_hash.v' class='invisible'>
|
||||
<code>sibling_hash: <a class='enum' href='../merkle/enum.Positioned.html' title='merkle::Positioned'>Positioned</a><<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>></code>
|
||||
</span></span><span class='stab '></span><span id='structfield.sub_proof' class='structfield'>
|
||||
<span id='sub_proof.v' class='invisible'>
|
||||
<code>sub_proof: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='struct' href='https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html' title='alloc::boxed::Box'>Box</a><<a class='struct' href='../merkle/struct.ProofBlock.html' title='merkle::ProofBlock'>ProofBlock</a>>></code>
|
||||
</span></span><span class='stab '></span><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl <a class='struct' href='../merkle/struct.ProofBlock.html' title='merkle::ProofBlock'>ProofBlock</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-75' class='srclink' href='../src/merkle/src/proof.rs.html#64-117' title='goto source code'>[src]</a></span></h3>
|
||||
<div class='impl-items'><h4 id='method.new' class='method'><span id='new.v' class='invisible'><code>fn <a href='#method.new' class='fnname'>new</a><T>(tree: &Tree<T>, needle: &<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>) -> <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='struct' href='../merkle/struct.ProofBlock.html' title='merkle::ProofBlock'>ProofBlock</a>> <span class='where'>where T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/convert/trait.Into.html' title='core::convert::Into'>Into</a><<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>> + <a class='trait' href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a></span></code></span></h4>
|
||||
<div class='docblock'><p>Attempt to generate a proof that the hash <code>needle</code> is a member of the given <code>tree</code>.</p>
|
||||
</div></div></section>
|
||||
<section id='search' class="content hidden"></section>
|
||||
|
||||
<section class="footer"></section>
|
||||
|
||||
<aside id="help" class="hidden">
|
||||
<div>
|
||||
<h1 class="hidden">Help</h1>
|
||||
|
||||
<div class="shortcuts">
|
||||
<h2>Keyboard Shortcuts</h2>
|
||||
|
||||
<dl>
|
||||
<dt>?</dt>
|
||||
<dd>Show this help dialog</dd>
|
||||
<dt>S</dt>
|
||||
<dd>Focus the search field</dd>
|
||||
<dt>⇤</dt>
|
||||
<dd>Move up in search results</dd>
|
||||
<dt>⇥</dt>
|
||||
<dd>Move down in search results</dd>
|
||||
<dt>⏎</dt>
|
||||
<dd>Go to active search result</dd>
|
||||
<dt>+</dt>
|
||||
<dd>Collapse/expand all sections</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="infos">
|
||||
<h2>Search Tricks</h2>
|
||||
|
||||
<p>
|
||||
Prefix searches with a type followed by a colon (e.g.
|
||||
<code>fn:</code>) to restrict the search to a given type.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Accepted types are: <code>fn</code>, <code>mod</code>,
|
||||
<code>struct</code>, <code>enum</code>,
|
||||
<code>trait</code>, <code>type</code>, <code>macro</code>,
|
||||
and <code>const</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Search functions by type signature (e.g.
|
||||
<code>vec -> usize</code> or <code>* -> vec</code>)
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
window.rootPath = "../";
|
||||
window.currentCrate = "merkle";
|
||||
</script>
|
||||
<script src="../jquery.js"></script>
|
||||
<script src="../main.js"></script>
|
||||
<script defer src="../search-index.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,128 +0,0 @@
|
||||
<!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 `MerkleDigest` trait in crate `merkle`.">
|
||||
<meta name="keywords" content="rust, rustlang, rust-lang, MerkleDigest">
|
||||
|
||||
<title>merkle::MerkleDigest - Rust</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../rustdoc.css">
|
||||
<link rel="stylesheet" type="text/css" href="../main.css">
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body class="rustdoc">
|
||||
<!--[if lte IE 8]>
|
||||
<div class="warning">
|
||||
This old browser is unsupported and will most likely display funky
|
||||
things.
|
||||
</div>
|
||||
<![endif]-->
|
||||
|
||||
|
||||
|
||||
<nav class="sidebar">
|
||||
|
||||
<p class='location'><a href='index.html'>merkle</a></p><script>window.sidebarCurrent = {name: 'MerkleDigest', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script>
|
||||
</nav>
|
||||
|
||||
<nav class="sub">
|
||||
<form class="search-form js-only">
|
||||
<div class="search-container">
|
||||
<input class="search-input" name="search"
|
||||
autocomplete="off"
|
||||
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
|
||||
type="search">
|
||||
</div>
|
||||
</form>
|
||||
</nav>
|
||||
|
||||
<section id='main' class="content trait">
|
||||
<h1 class='fqn'><span class='in-band'>Trait <a href='index.html'>merkle</a>::<wbr><a class='trait' href=''>MerkleDigest</a></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
|
||||
[<span class='inner'>−</span>]
|
||||
</a>
|
||||
</span><a id='src-109' class='srclink' href='../src/merkle/src/merkledigest.rs.html#5-12' title='goto source code'>[src]</a></span></h1>
|
||||
<pre class='rust trait'>pub trait MerkleDigest {
|
||||
fn <a href='#tymethod.hash_bytes' class='fnname'>hash_bytes</a>(&mut self, bytes: &<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>) -> <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>;
|
||||
fn <a href='#tymethod.combine_hashes' class='fnname'>combine_hashes</a>(&mut self, left: &<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>, right: &<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>) -> <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>;
|
||||
}</pre><div class='docblock'><p>The sole purpose of this trait is to extend the standard
|
||||
<code>crypto::digest::Digest</code> with a couple utility functions.</p>
|
||||
</div>
|
||||
<h2 id='required-methods'>Required Methods</h2>
|
||||
<div class='methods'>
|
||||
<h3 id='tymethod.hash_bytes' class='method stab '><span id='hash_bytes.v' class='invisible'><code>fn <a href='#tymethod.hash_bytes' class='fnname'>hash_bytes</a>(&mut self, bytes: &<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>) -> <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>></code></span></h3><div class='docblock'><p>Compute the hash the given byte array</p>
|
||||
</div><h3 id='tymethod.combine_hashes' class='method stab '><span id='combine_hashes.v' class='invisible'><code>fn <a href='#tymethod.combine_hashes' class='fnname'>combine_hashes</a>(&mut self, left: &<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>, right: &<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>) -> <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>></code></span></h3><div class='docblock'><p>Compute the hash of the concatenation of <code>left</code> and <code>right</code></p>
|
||||
</div></div>
|
||||
<h2 id='implementors'>Implementors</h2>
|
||||
<ul class='item-list' id='implementors-list'>
|
||||
<li><code>impl<D> MerkleDigest for D <span class='where'>where D: Digest</span></code></li>
|
||||
</ul><script type="text/javascript" async
|
||||
src="../implementors/merkle/trait.MerkleDigest.js">
|
||||
</script></section>
|
||||
<section id='search' class="content hidden"></section>
|
||||
|
||||
<section class="footer"></section>
|
||||
|
||||
<aside id="help" class="hidden">
|
||||
<div>
|
||||
<h1 class="hidden">Help</h1>
|
||||
|
||||
<div class="shortcuts">
|
||||
<h2>Keyboard Shortcuts</h2>
|
||||
|
||||
<dl>
|
||||
<dt>?</dt>
|
||||
<dd>Show this help dialog</dd>
|
||||
<dt>S</dt>
|
||||
<dd>Focus the search field</dd>
|
||||
<dt>⇤</dt>
|
||||
<dd>Move up in search results</dd>
|
||||
<dt>⇥</dt>
|
||||
<dd>Move down in search results</dd>
|
||||
<dt>⏎</dt>
|
||||
<dd>Go to active search result</dd>
|
||||
<dt>+</dt>
|
||||
<dd>Collapse/expand all sections</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="infos">
|
||||
<h2>Search Tricks</h2>
|
||||
|
||||
<p>
|
||||
Prefix searches with a type followed by a colon (e.g.
|
||||
<code>fn:</code>) to restrict the search to a given type.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Accepted types are: <code>fn</code>, <code>mod</code>,
|
||||
<code>struct</code>, <code>enum</code>,
|
||||
<code>trait</code>, <code>type</code>, <code>macro</code>,
|
||||
and <code>const</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Search functions by type signature (e.g.
|
||||
<code>vec -> usize</code> or <code>* -> vec</code>)
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
window.rootPath = "../";
|
||||
window.currentCrate = "merkle";
|
||||
</script>
|
||||
<script src="../jquery.js"></script>
|
||||
<script src="../main.js"></script>
|
||||
<script defer src="../search-index.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=enum.Positioned.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="enum.Positioned.html">enum.Positioned.html</a>...</p>
|
||||
<script>location.replace("enum.Positioned.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=struct.Proof.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="struct.Proof.html">struct.Proof.html</a>...</p>
|
||||
<script>location.replace("struct.Proof.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=struct.ProofBlock.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="struct.ProofBlock.html">struct.ProofBlock.html</a>...</p>
|
||||
<script>location.replace("struct.ProofBlock.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../merkle/enum.Positioned.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../merkle/enum.Positioned.html">../../merkle/enum.Positioned.html</a>...</p>
|
||||
<script>location.replace("../../merkle/enum.Positioned.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../merkle/struct.ProofBlock.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../merkle/struct.ProofBlock.html">../../merkle/struct.ProofBlock.html</a>...</p>
|
||||
<script>location.replace("../../merkle/struct.ProofBlock.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
56
docs/playpen.js
Normal file
56
docs/playpen.js
Normal file
@ -0,0 +1,56 @@
|
||||
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
/*jslint browser: true, es5: true */
|
||||
/*globals $: true, rootPath: true */
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
'use strict';
|
||||
|
||||
if (!window.playgroundUrl) {
|
||||
return;
|
||||
}
|
||||
|
||||
var featureRegexp = new RegExp('^\s*#!\\[feature\\(\.*?\\)\\]');
|
||||
var elements = document.querySelectorAll('pre.rust-example-rendered');
|
||||
|
||||
Array.prototype.forEach.call(elements, function(el) {
|
||||
el.onmouseover = function(e) {
|
||||
if (el.contains(e.relatedTarget)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var a = document.createElement('a');
|
||||
a.setAttribute('class', 'test-arrow');
|
||||
a.textContent = 'Run';
|
||||
|
||||
var code = el.previousElementSibling.textContent;
|
||||
|
||||
var channel = '';
|
||||
if (featureRegexp.test(code)) {
|
||||
channel = '&version=nightly';
|
||||
}
|
||||
|
||||
a.setAttribute('href', window.playgroundUrl + '?code=' +
|
||||
encodeURIComponent(code) + channel);
|
||||
a.setAttribute('target', '_blank');
|
||||
|
||||
el.appendChild(a);
|
||||
};
|
||||
|
||||
el.onmouseout = function(e) {
|
||||
if (el.contains(e.relatedTarget)) {
|
||||
return;
|
||||
}
|
||||
|
||||
el.removeChild(el.querySelectorAll('a.test-arrow')[0]);
|
||||
};
|
||||
});
|
||||
});
|
@ -1,5 +1,3 @@
|
||||
@import "normalize.css";
|
||||
|
||||
/**
|
||||
* Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
* file at the top-level directory of this distribution and at
|
||||
@ -61,6 +59,8 @@
|
||||
src: local('Source Code Pro Semibold'), url("SourceCodePro-Semibold.woff") format('woff');
|
||||
}
|
||||
|
||||
@import "normalize.css";
|
||||
|
||||
* {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
@ -130,11 +130,11 @@ code, pre {
|
||||
font-family: "Source Code Pro", Menlo, Monaco, Consolas, "DejaVu Sans Mono", Inconsolata, monospace;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.docblock code, .docblock-short code {
|
||||
.docblock code {
|
||||
border-radius: 3px;
|
||||
padding: 0 0.2em;
|
||||
}
|
||||
.docblock pre code, .docblock-short pre code {
|
||||
.docblock pre code {
|
||||
padding: 0;
|
||||
}
|
||||
pre {
|
||||
@ -239,23 +239,23 @@ nav.sub {
|
||||
}
|
||||
.line-numbers span { cursor: pointer; }
|
||||
|
||||
.docblock-short p {
|
||||
.docblock.short p {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.docblock-short.nowrap {
|
||||
.docblock.short.nowrap {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.docblock-short p {
|
||||
.docblock.short p {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
margin: 0;
|
||||
}
|
||||
.docblock-short code { white-space: nowrap; }
|
||||
.docblock.short code { white-space: nowrap; }
|
||||
|
||||
.docblock h1, .docblock h2, .docblock h3, .docblock h4, .docblock h5 {
|
||||
border-bottom: 1px solid;
|
||||
@ -284,7 +284,7 @@ h3.impl > .out-of-band {
|
||||
font-size: 21px;
|
||||
}
|
||||
|
||||
h4 > code, h3 > code, .invisible > code {
|
||||
h4 > code, h3 > code {
|
||||
position: inherit;
|
||||
}
|
||||
|
||||
@ -292,12 +292,6 @@ h4 > code, h3 > code, .invisible > code {
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.invisible {
|
||||
background: rgba(0, 0, 0, 0);
|
||||
width: 100%;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.content .in-band {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
@ -378,11 +372,6 @@ h4 > code, h3 > code, .invisible > code {
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
/* Shift where in trait listing down a line */
|
||||
pre.trait .where::before {
|
||||
content: '\a ';
|
||||
}
|
||||
|
||||
nav {
|
||||
border-bottom: 1px solid;
|
||||
padding-bottom: 10px;
|
||||
@ -414,7 +403,7 @@ a {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.docblock a:hover, .docblock-short a:hover, .stability a {
|
||||
.docblock a:hover, .stability a {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
@ -464,8 +453,7 @@ a {
|
||||
.content .search-results td:first-child { padding-right: 0; }
|
||||
.content .search-results td:first-child a { padding-right: 10px; }
|
||||
|
||||
tr.result span.primitive::after { content: ' (primitive type)'; font-style: italic; color: black;
|
||||
}
|
||||
tr.result span.primitive::after { content: ' (primitive type)'; font-style: italic; color: black}
|
||||
|
||||
body.blur > :not(#help) {
|
||||
filter: blur(8px);
|
||||
@ -570,26 +558,19 @@ pre.rust .self, pre.rust .bool-val, pre.rust .prelude-val,
|
||||
pre.rust .attribute, pre.rust .attribute .ident { color: #C82829; }
|
||||
pre.rust .macro, pre.rust .macro-nonterminal { color: #3E999F; }
|
||||
pre.rust .lifetime { color: #B76514; }
|
||||
pre.rust .question-mark {
|
||||
color: #ff9011;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.rusttest { display: none; }
|
||||
pre.rust { position: relative; }
|
||||
a.test-arrow {
|
||||
background-color: rgba(78, 139, 202, 0.2);
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
background-color: #4e8bca;
|
||||
padding: 5px 10px 5px 10px;
|
||||
border-radius: 5px;
|
||||
font-size: 130%;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
}
|
||||
a.test-arrow:hover{
|
||||
background-color: #4e8bca;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.section-header:hover a:after {
|
||||
content: '\2002\00a7\2002';
|
||||
@ -679,7 +660,6 @@ span.since {
|
||||
|
||||
:target > code {
|
||||
background: #FDFFD3;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* Media Queries */
|
||||
|
@ -1,3 +1,3 @@
|
||||
var searchIndex = {};
|
||||
searchIndex["merkle"] = {"doc":"*merkle* implements a Merkle Tree in Rust.","items":[[3,"MerkleTree","merkle","A Merkle tree is a binary tree, with values of type `T` at the leafs,\nand where every node holds the hash of the concatenation of the hashes of\nits children nodes.",null,null],[12,"digest","","The hashing function used by this Merkle tree",0,null],[12,"tree","","The inner binary tree",0,null],[12,"height","","The height of the tree",0,null],[12,"count","","The number of leaf nodes in the tree",0,null],[3,"Proof","","An inclusion proof represent the fact that `value` is a member of a `MerkleTree`\nwith root hash `root_hash`, and hash function `digest`.\nA proof is a linked-list of `ProofBlock`s.\nTODO: Represent a proof as a vector of ProofBlock instead of a linked-list?",null,null],[12,"digest","","",1,null],[12,"root_hash","","",1,null],[12,"block","","",1,null],[12,"value","","",1,null],[3,"ProofBlock","","A `ProofBlock` is a linked-list holding the hash of the node, the hash of its sibling node,\nand the rest of the inclusion proof.",null,null],[12,"node_hash","","",2,null],[12,"sibling_hash","","",2,null],[12,"sub_proof","","",2,null],[4,"Positioned","","Tags a value so that we know from in branch (if any) it was found.",null,null],[13,"Nowhere","","No value was found",3,null],[13,"Left","","The value was found in the left branch",3,null],[13,"Right","","The value was found in the right branch",3,null],[11,"from_vec","","Constructs a Merkle Tree from a vector of data blocks",0,{"inputs":[{"name":"d"},{"name":"vec"}],"output":{"name":"self"}}],[11,"root_hash","","Returns the tree's root hash",0,null],[11,"gen_proof","","Generate an inclusion proof for the given value.\n`None` is returned if the given value is not found in the tree.",0,null],[11,"validate","","",1,null],[11,"validate_block","","",1,null],[11,"new","","Attempt to generate a proof that the hash `needle` is a member of the given `tree`.",2,{"inputs":[{"name":"tree"},{"name":"vec"}],"output":{"name":"option"}}],[11,"eq","","",3,null],[11,"ne","","",3,null],[8,"MerkleDigest","","The sole purpose of this trait is to extend the standard\n`crypto::digest::Digest` with a couple utility functions.",null,null],[10,"hash_bytes","","Compute the hash the given byte array",4,null],[10,"combine_hashes","","Compute the hash of the concatenation of `left` and `right`",4,null]],"paths":[[3,"MerkleTree"],[3,"Proof"],[3,"ProofBlock"],[4,"Positioned"],[8,"MerkleDigest"]]};
|
||||
searchIndex["merkle"] = {"doc":"*merkle* implements a Merkle Tree in Rust.","items":[[3,"MerkleTree","merkle","A Merkle tree is a binary tree, with values of type `T` at the leafs,\nand where every node holds the hash of the concatenation of the hashes of\nits children nodes.",null,null],[12,"digest","","The hashing function used by this Merkle tree",0,null],[12,"tree","","The inner binary tree",0,null],[12,"height","","The height of the tree",0,null],[12,"count","","The number of leaf nodes in the tree",0,null],[3,"Proof","","An inclusion proof represent the fact that a `value` is a member\nof a `MerkleTree` with root hash `root_hash`, and hash function `digest`.",null,null],[12,"digest","","",1,null],[12,"root_hash","","",1,null],[12,"block","","",1,null],[12,"value","","",1,null],[11,"from_vec","","Constructs a Merkle Tree from a vector of data blocks",0,{"inputs":[{"name":"d"},{"name":"vec"}],"output":{"name":"self"}}],[11,"root_hash","","Returns the tree's root hash",0,null],[11,"gen_proof","","Generate an inclusion proof for the given value.\n`None` is returned if the given value is not found in the tree.",0,null],[11,"validate","","",1,null],[11,"validate_block","","",1,null]],"paths":[[3,"MerkleTree"],[3,"Proof"]]};
|
||||
initSearch(searchIndex);
|
||||
|
@ -60,7 +60,6 @@
|
||||
<span id="16">16</span>
|
||||
<span id="17">17</span>
|
||||
<span id="18">18</span>
|
||||
<span id="19">19</span>
|
||||
</pre><pre class='rust '>
|
||||
|
||||
<span class='doccomment'>//! *merkle* implements a Merkle Tree in Rust.</span>
|
||||
@ -68,13 +67,12 @@
|
||||
<span class='kw'>extern</span> <span class='kw'>crate</span> <span class='ident'>crypto</span>;
|
||||
|
||||
<span class='kw'>mod</span> <span class='ident'>merkletree</span>;
|
||||
<span class='kw'>pub</span> <span class='kw'>use</span> <span class='ident'>merkletree</span>::{ <span class='ident'>MerkleTree</span> };
|
||||
<span class='kw'>pub</span> <span class='kw'>use</span> <span class='ident'>merkletree</span>::<span class='ident'>MerkleTree</span>;
|
||||
|
||||
<span class='kw'>mod</span> <span class='ident'>proof</span>;
|
||||
<span class='kw'>pub</span> <span class='kw'>use</span> <span class='ident'>proof</span>::{ <span class='ident'>Proof</span>, <span class='ident'>ProofBlock</span>, <span class='ident'>Positioned</span> };
|
||||
<span class='kw'>pub</span> <span class='kw'>use</span> <span class='ident'>proof</span>::<span class='ident'>Proof</span>;
|
||||
|
||||
<span class='kw'>mod</span> <span class='ident'>merkledigest</span>;
|
||||
<span class='kw'>pub</span> <span class='kw'>use</span> <span class='ident'>merkledigest</span>::{ <span class='ident'>MerkleDigest</span> };
|
||||
|
||||
<span class='kw'>mod</span> <span class='ident'>tree</span>;
|
||||
|
||||
@ -138,9 +136,11 @@
|
||||
<script>
|
||||
window.rootPath = "../../../";
|
||||
window.currentCrate = "merkle";
|
||||
window.playgroundUrl = "";
|
||||
</script>
|
||||
<script src="../../../jquery.js"></script>
|
||||
<script src="../../../main.js"></script>
|
||||
|
||||
<script defer src="../../../search-index.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -176,9 +176,11 @@
|
||||
<script>
|
||||
window.rootPath = "../../../";
|
||||
window.currentCrate = "merkle";
|
||||
window.playgroundUrl = "";
|
||||
</script>
|
||||
<script src="../../../jquery.js"></script>
|
||||
<script src="../../../main.js"></script>
|
||||
|
||||
<script defer src="../../../search-index.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -320,9 +320,11 @@
|
||||
<script>
|
||||
window.rootPath = "../../../";
|
||||
window.currentCrate = "merkle";
|
||||
window.playgroundUrl = "";
|
||||
</script>
|
||||
<script src="../../../jquery.js"></script>
|
||||
<script src="../../../main.js"></script>
|
||||
|
||||
<script defer src="../../../search-index.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -172,8 +172,6 @@
|
||||
<span id="128">128</span>
|
||||
<span id="129">129</span>
|
||||
<span id="130">130</span>
|
||||
<span id="131">131</span>
|
||||
<span id="132">132</span>
|
||||
</pre><pre class='rust '>
|
||||
|
||||
<span class='kw'>use</span> <span class='ident'>crypto</span>::<span class='ident'>digest</span>::<span class='ident'>Digest</span>;
|
||||
@ -181,10 +179,8 @@
|
||||
<span class='kw'>use</span> <span class='ident'>merkledigest</span>::{ <span class='ident'>MerkleDigest</span> };
|
||||
<span class='kw'>use</span> <span class='ident'>tree</span>::{ <span class='ident'>Tree</span> };
|
||||
|
||||
<span class='doccomment'>/// An inclusion proof represent the fact that `value` is a member of a `MerkleTree`</span>
|
||||
<span class='doccomment'>/// with root hash `root_hash`, and hash function `digest`.</span>
|
||||
<span class='doccomment'>/// A proof is a linked-list of `ProofBlock`s.</span>
|
||||
<span class='doccomment'>/// TODO: Represent a proof as a vector of ProofBlock instead of a linked-list?</span>
|
||||
<span class='doccomment'>/// An inclusion proof represent the fact that a `value` is a member</span>
|
||||
<span class='doccomment'>/// of a `MerkleTree` with root hash `root_hash`, and hash function `digest`.</span>
|
||||
<span class='kw'>pub</span> <span class='kw'>struct</span> <span class='ident'>Proof</span><span class='op'><</span><span class='ident'>D</span>, <span class='ident'>T</span><span class='op'>></span> {
|
||||
<span class='kw'>pub</span> <span class='ident'>digest</span>: <span class='ident'>D</span>,
|
||||
<span class='kw'>pub</span> <span class='ident'>root_hash</span>: <span class='ident'>Vec</span><span class='op'><</span><span class='ident'>u8</span><span class='op'>></span>,
|
||||
@ -364,9 +360,11 @@
|
||||
<script>
|
||||
window.rootPath = "../../../";
|
||||
window.currentCrate = "merkle";
|
||||
window.playgroundUrl = "";
|
||||
</script>
|
||||
<script src="../../../jquery.js"></script>
|
||||
<script src="../../../main.js"></script>
|
||||
|
||||
<script defer src="../../../search-index.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -200,9 +200,11 @@
|
||||
<script>
|
||||
window.rootPath = "../../../";
|
||||
window.currentCrate = "merkle";
|
||||
window.playgroundUrl = "";
|
||||
</script>
|
||||
<script src="../../../jquery.js"></script>
|
||||
<script src="../../../main.js"></script>
|
||||
|
||||
<script defer src="../../../search-index.js"></script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user