Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
romac committed Jan 10, 2024
1 parent 314b10c commit 404b9bc
Show file tree
Hide file tree
Showing 1,656 changed files with 37,887 additions and 17,710 deletions.
2 changes: 1 addition & 1 deletion bech32/all.html

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions bech32/enum.Bech32.html

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions bech32/enum.Bech32m.html

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions bech32/enum.DecodeError.html

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions bech32/enum.DecodeFromReaderError.html

Large diffs are not rendered by default.

40 changes: 0 additions & 40 deletions bech32/enum.Error.html

This file was deleted.

27 changes: 27 additions & 0 deletions bech32/enum.NoChecksum.html

Large diffs are not rendered by default.

27 changes: 0 additions & 27 deletions bech32/enum.Variant.html

This file was deleted.

20 changes: 0 additions & 20 deletions bech32/fn.convert_bits.html

This file was deleted.

24 changes: 22 additions & 2 deletions bech32/fn.decode.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
<!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="Decode a bech32 string into the raw HRP and the data bytes."><title>decode in bech32 - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-9bb858ba049f1f21.css" id="mainThemeStyle"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="bech32" data-themes="" data-resource-suffix="" data-rustdoc-version="1.73.0-nightly (33a2c2487 2023-07-12)" data-channel="nightly" data-search-js="search-f6292fe389d70017.js" data-settings-js="settings-de11bff964e9d4e5.js" data-settings-css="settings-8c76f75bfb6bd192.css" data-theme-light-css="light-0f8c037637f9eb3e.css" data-theme-dark-css="dark-1097f8e92a01e3cf.css" data-theme-ayu-css="ayu-614652228113ac93.css" ><script src="../static.files/storage-59fd9b8ccb335783.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-0795b7d26be81095.js"></script><noscript><link rel="stylesheet" media="(prefers-color-scheme:light)" href="../static.files/light-0f8c037637f9eb3e.css"><link rel="stylesheet" media="(prefers-color-scheme:dark)" href="../static.files/dark-1097f8e92a01e3cf.css"><link rel="stylesheet" href="../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><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">&#9776;</button><a class="logo-container" href="../bech32/index.html"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../bech32/index.html"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><div class="sidebar-elems"><h2><a href="index.html">In bech32</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="index.html">bech32</a>::<wbr><a class="fn" href="#">decode</a><button id="copy-path" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/bech32/lib.rs.html#516-532">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub fn decode(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;(<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/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="struct.u5.html" title="struct bech32::u5">u5</a>&gt;, <a class="enum" href="enum.Variant.html" title="enum bech32::Variant">Variant</a>), <a class="enum" href="enum.Error.html" title="enum bech32::Error">Error</a>&gt;</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Decode a bech32 string into the raw HRP and the data bytes.</p>
<p>Returns the HRP in lowercase, the data with the checksum removed, and the encoding.</p>
<!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="Decodes a bech32 encoded string."><title>decode in bech32 - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-9bb858ba049f1f21.css" id="mainThemeStyle"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="bech32" data-themes="" data-resource-suffix="" data-rustdoc-version="1.73.0-nightly (33a2c2487 2023-07-12)" data-channel="nightly" data-search-js="search-f6292fe389d70017.js" data-settings-js="settings-de11bff964e9d4e5.js" data-settings-css="settings-8c76f75bfb6bd192.css" data-theme-light-css="light-0f8c037637f9eb3e.css" data-theme-dark-css="dark-1097f8e92a01e3cf.css" data-theme-ayu-css="ayu-614652228113ac93.css" ><script src="../static.files/storage-59fd9b8ccb335783.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-0795b7d26be81095.js"></script><noscript><link rel="stylesheet" media="(prefers-color-scheme:light)" href="../static.files/light-0f8c037637f9eb3e.css"><link rel="stylesheet" media="(prefers-color-scheme:dark)" href="../static.files/dark-1097f8e92a01e3cf.css"><link rel="stylesheet" href="../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><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">&#9776;</button><a class="logo-container" href="../bech32/index.html"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../bech32/index.html"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><div class="sidebar-elems"><h2><a href="index.html">In bech32</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="index.html">bech32</a>::<wbr><a class="fn" href="#">decode</a><button id="copy-path" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/bech32/lib.rs.html#196-209">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub fn decode(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;(<a class="struct" href="struct.Hrp.html" title="struct bech32::Hrp">Hrp</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;), <a class="enum" href="enum.DecodeError.html" title="enum bech32::DecodeError">DecodeError</a>&gt;</code></pre><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>alloc</code></strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Decodes a bech32 encoded string.</p>
<p>If this function succeeds the input string was found to be well formed (hrp, separator, bech32
characters), and to have either a valid bech32m checksum or a valid bech32 checksum.</p>
<p>If your input string has no checksum use the <a href="primitives/decode/struct.CheckedHrpstring.html" title="struct bech32::primitives::decode::CheckedHrpstring"><code>CheckedHrpstring</code></a> constructor, which allows selecting the checksum algorithm explicitly.</p>
<h2 id="returns"><a href="#returns">Returns</a></h2>
<p>The human-readable part and the encoded data with the checksum removed.</p>
<h2 id="examples"><a href="#examples">Examples</a></h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bech32::{decode, Bech32, Bech32m, NoChecksum};
<span class="kw">use </span>bech32::primitives::decode::CheckedHrpstring;

<span class="kw">const </span>BECH32: <span class="kw-2">&amp;</span>str = <span class="string">&quot;abc14w46h2at4w46h2at4w46h2at4w46h2atsghld7&quot;</span>;
<span class="kw">const </span>BECH32M: <span class="kw-2">&amp;</span>str = <span class="string">&quot;abc14w46h2at4w46h2at4w46h2at4w46h2at958ngu&quot;</span>;
<span class="kw">const </span>NO_CHECKSUM: <span class="kw-2">&amp;</span>str = <span class="string">&quot;abc14w46h2at4w46h2at4w46h2at4w46h2at&quot;</span>;

<span class="kw">let </span>(hrp, data) = decode(<span class="kw-2">&amp;</span>BECH32).expect(<span class="string">&quot;valid address with valid bech32 checksum&quot;</span>);
<span class="kw">let </span>(hrp, data) = decode(<span class="kw-2">&amp;</span>BECH32M).expect(<span class="string">&quot;valid address with valid bech32m checksum&quot;</span>);
<span class="macro">assert!</span>(decode(<span class="kw-2">&amp;</span>NO_CHECKSUM).is_err());

<span class="comment">// You can control the checksum algorithm directly by using the [`CheckedHrpstring`] type.
</span><span class="kw">let </span>p = CheckedHrpstring::new::&lt;Bech32&gt;(<span class="kw-2">&amp;</span>BECH32).expect(<span class="string">&quot;valid address with valid bech32 checksum&quot;</span>);
<span class="kw">let </span>p = CheckedHrpstring::new::&lt;Bech32m&gt;(<span class="kw-2">&amp;</span>BECH32M).expect(<span class="string">&quot;valid address with valid bech32 checksum&quot;</span>);
<span class="kw">let </span>p = CheckedHrpstring::new::&lt;NoChecksum&gt;(<span class="kw-2">&amp;</span>NO_CHECKSUM).expect(<span class="string">&quot;valid address with no checksum&quot;</span>);</code></pre></div>
</div></details></section></div></main></body></html>
Loading

0 comments on commit 404b9bc

Please sign in to comment.