213 lines
49 KiB
HTML
213 lines
49 KiB
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="Base-conversion specification"><title>Specification in data_encoding - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.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-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="data_encoding" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc struct"><!--[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="../data_encoding/index.html">data_<wbr>encoding</a><span class="version">2.6.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Specification</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#theory" title="Theory">Theory</a><ul><li><a href="#basics" title="Basics">Basics</a></li><li><a href="#extensions" title="Extensions">Extensions</a></li></ul></li><li><a href="#practice" title="Practice">Practice</a><ul><li><a href="#basics-1" title="Basics">Basics</a></li><li><a href="#extensions-1" title="Extensions">Extensions</a></li></ul></li></ul><h3><a href="#fields">Fields</a></h3><ul class="block structfield"><li><a href="#structfield.bit_order" title="bit_order">bit_order</a></li><li><a href="#structfield.check_trailing_bits" title="check_trailing_bits">check_trailing_bits</a></li><li><a href="#structfield.ignore" title="ignore">ignore</a></li><li><a href="#structfield.padding" title="padding">padding</a></li><li><a href="#structfield.symbols" title="symbols">symbols</a></li><li><a href="#structfield.translate" title="translate">translate</a></li><li><a href="#structfield.wrap" title="wrap">wrap</a></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.encoding" title="encoding">encoding</a></li><li><a href="#method.new" title="new">new</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Clone-for-Specification" title="Clone">Clone</a></li><li><a href="#impl-Debug-for-Specification" title="Debug">Debug</a></li><li><a href="#impl-Default-for-Specification" title="Default">Default</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-Specification" title="Freeze">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-Specification" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-Send-for-Specification" title="Send">Send</a></li><li><a href="#impl-Sync-for-Specification" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-Specification" title="Unpin">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Specification" title="UnwindSafe">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T" title="Any">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T" title="Borrow<T>">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut<T>">BorrowMut<T></a></li><li><a href="#impl-CloneToUninit-for-T" title="CloneToUninit">CloneToUninit</a></li><li><a href="#impl-From%3CT%3E-for-T" title="From<T>">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into<U>">Into<U></a></li><li><a href="#impl-ToOwned-for-T" title="ToOwned">ToOwned</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T" title="TryFrom<U>">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto<U>">TryInto<U></a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate data_<wbr>encoding</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">data_encoding</a></span><h1>Struct <span class="struct">Specification</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/data_encoding/lib.rs.html#1162-1205">Source</a> </span></div><pre class="rust item-decl"><code>pub struct Specification {
|
||
pub symbols: <a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>,
|
||
pub bit_order: <a class="enum" href="enum.BitOrder.html" title="enum data_encoding::BitOrder">BitOrder</a>,
|
||
pub check_trailing_bits: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.bool.html">bool</a>,
|
||
pub padding: <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.char.html">char</a>>,
|
||
pub ignore: <a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>,
|
||
pub wrap: <a class="struct" href="struct.Wrap.html" title="struct data_encoding::Wrap">Wrap</a>,
|
||
pub translate: <a class="struct" href="struct.Translate.html" title="struct data_encoding::Translate">Translate</a>,
|
||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Base-conversion specification</p>
|
||
<p>It is possible to define custom encodings given a specification. To do so, it is important to
|
||
understand the theory first.</p>
|
||
<h2 id="theory"><a class="doc-anchor" href="#theory">§</a>Theory</h2>
|
||
<p>Each subsection has an equivalent subsection in the <a href="#practice">Practice</a> section.</p>
|
||
<h3 id="basics"><a class="doc-anchor" href="#basics">§</a>Basics</h3>
|
||
<p>The main idea of a <a href="https://en.wikipedia.org/wiki/Positional_notation#Base_conversion">base-conversion</a> encoding is to see <code>[u8]</code> as numbers written in
|
||
little-endian base256 and convert them in another little-endian base. For performance reasons,
|
||
this crate restricts this other base to be of size 2 (binary), 4 (base4), 8 (octal), 16
|
||
(hexadecimal), 32 (base32), or 64 (base64). The converted number is written as <code>[u8]</code> although
|
||
it doesn’t use all the 256 possible values of <code>u8</code>. This crate encodes to ASCII, so only values
|
||
smaller than 128 are allowed.</p>
|
||
<p>More precisely, we need the following elements:</p>
|
||
<ul>
|
||
<li>The bit-width N: 1 for binary, 2 for base4, 3 for octal, 4 for hexadecimal, 5 for base32, and
|
||
6 for base64</li>
|
||
<li>The <a href="enum.BitOrder.html">bit-order</a>: most or least significant bit first</li>
|
||
<li>The symbols function S from [0, 2<sup>N</sup>) (called values and written <code>uN</code>) to symbols
|
||
(represented as <code>u8</code> although only ASCII symbols are allowed, i.e. smaller than 128)</li>
|
||
<li>The values partial function V from ASCII to [0, 2<sup>N</sup>), i.e. from <code>u8</code> to <code>uN</code></li>
|
||
<li>Whether trailing bits are checked: trailing bits are leading zeros in theory, but since
|
||
numbers are little-endian they come last</li>
|
||
</ul>
|
||
<p>For the encoding to be correct (i.e. encoding then decoding gives back the initial input),
|
||
V(S(i)) must be defined and equal to i for all i in [0, 2<sup>N</sup>). For the encoding to be
|
||
<a href="https://tools.ietf.org/html/rfc4648#section-3.5">canonical</a> (i.e. different inputs decode to different outputs, or equivalently,
|
||
decoding then encoding gives back the initial input), trailing bits must be checked and if V(i)
|
||
is defined then S(V(i)) is equal to i for all i.</p>
|
||
<p>Encoding and decoding are given by the following pipeline:</p>
|
||
<div class="example-wrap"><pre class="language-text"><code>[u8] <--1--> [[bit; 8]] <--2--> [[bit; N]] <--3--> [uN] <--4--> [u8]
|
||
1: Map bit-order between each u8 and [bit; 8]
|
||
2: Base conversion between base 2^8 and base 2^N (check trailing bits)
|
||
3: Map bit-order between each [bit; N] and uN
|
||
4: Map symbols/values between each uN and u8 (values must be defined)</code></pre></div><h3 id="extensions"><a class="doc-anchor" href="#extensions">§</a>Extensions</h3>
|
||
<p>All these extensions make the encoding not canonical.</p>
|
||
<h4 id="padding"><a class="doc-anchor" href="#padding">§</a>Padding</h4>
|
||
<p>Padding is useful if the following conditions are met:</p>
|
||
<ul>
|
||
<li>the bit-width is 3 (octal), 5 (base32), or 6 (base64)</li>
|
||
<li>the length of the data to encode is not known in advance</li>
|
||
<li>the data must be sent without buffering</li>
|
||
</ul>
|
||
<p>Bases for which the bit-width N does not divide 8 may not concatenate encoded data. This comes
|
||
from the fact that it is not possible to make the difference between trailing bits and encoding
|
||
bits. Padding solves this issue by adding a new character to discriminate between trailing bits
|
||
and encoding bits. The idea is to work by blocks of lcm(8, N) bits, where lcm(8, N) is the least
|
||
common multiple of 8 and N. When such block is not complete, it is padded.</p>
|
||
<p>To preserve correctness, the padding character must not be a symbol.</p>
|
||
<h4 id="ignore-characters-when-decoding"><a class="doc-anchor" href="#ignore-characters-when-decoding">§</a>Ignore characters when decoding</h4>
|
||
<p>Ignoring characters when decoding is useful if after encoding some characters are added for
|
||
convenience or any other reason (like wrapping). In that case we want to first ignore those
|
||
characters before decoding.</p>
|
||
<p>To preserve correctness, ignored characters must not contain symbols or the padding character.</p>
|
||
<h4 id="wrap-output-when-encoding"><a class="doc-anchor" href="#wrap-output-when-encoding">§</a>Wrap output when encoding</h4>
|
||
<p>Wrapping output when encoding is useful if the output is meant to be printed in a document where
|
||
width is limited (typically 80-columns documents). In that case, the wrapping width and the
|
||
wrapping separator have to be defined.</p>
|
||
<p>To preserve correctness, the wrapping separator characters must be ignored (see previous
|
||
subsection). As such, wrapping separator characters must also not contain symbols or the padding
|
||
character.</p>
|
||
<h4 id="translate-characters-when-decoding"><a class="doc-anchor" href="#translate-characters-when-decoding">§</a>Translate characters when decoding</h4>
|
||
<p>Translating characters when decoding is useful when encoded data may be copied by a humain
|
||
instead of a machine. Humans tend to confuse some characters for others. In that case we want to
|
||
translate those characters before decoding.</p>
|
||
<p>To preserve correctness, the characters we translate <em>from</em> must not contain symbols or the
|
||
padding character, and the characters we translate <em>to</em> must only contain symbols or the padding
|
||
character.</p>
|
||
<h2 id="practice"><a class="doc-anchor" href="#practice">§</a>Practice</h2><h3 id="basics-1"><a class="doc-anchor" href="#basics-1">§</a>Basics</h3>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>data_encoding::{Encoding, Specification};
|
||
<span class="kw">fn </span>make_encoding(symbols: <span class="kw-2">&</span>str) -> Encoding {
|
||
<span class="kw">let </span><span class="kw-2">mut </span>spec = Specification::new();
|
||
spec.symbols.push_str(symbols);
|
||
spec.encoding().unwrap()
|
||
}
|
||
<span class="kw">let </span>binary = make_encoding(<span class="string">"01"</span>);
|
||
<span class="kw">let </span>octal = make_encoding(<span class="string">"01234567"</span>);
|
||
<span class="kw">let </span>hexadecimal = make_encoding(<span class="string">"0123456789abcdef"</span>);
|
||
<span class="macro">assert_eq!</span>(binary.encode(<span class="string">b"Bit"</span>), <span class="string">"010000100110100101110100"</span>);
|
||
<span class="macro">assert_eq!</span>(octal.encode(<span class="string">b"Bit"</span>), <span class="string">"20464564"</span>);
|
||
<span class="macro">assert_eq!</span>(hexadecimal.encode(<span class="string">b"Bit"</span>), <span class="string">"426974"</span>);</code></pre></div>
|
||
<p>The <code>binary</code> base has 2 symbols <code>0</code> and <code>1</code> with value 0 and 1 respectively. The <code>octal</code> base
|
||
has 8 symbols <code>0</code> to <code>7</code> with value 0 to 7. The <code>hexadecimal</code> base has 16 symbols <code>0</code> to <code>9</code> and
|
||
<code>a</code> to <code>f</code> with value 0 to 15. The following diagram gives the idea of how encoding works in the
|
||
previous example (note that we can actually write such diagram only because the bit-order is
|
||
most significant first):</p>
|
||
<div class="example-wrap"><pre class="language-text"><code>[ octal] | 2 : 0 : 4 : 6 : 4 : 5 : 6 : 4 |
|
||
[ binary] |0 1 0 0 0 0 1 0|0 1 1 0 1 0 0 1|0 1 1 1 0 1 0 0|
|
||
[hexadecimal] | 4 : 2 | 6 : 9 | 7 : 4 |
|
||
^-- LSB ^-- MSB</code></pre></div>
|
||
<p>Note that in theory, these little-endian numbers are read from right to left (the most
|
||
significant bit is at the right). Since leading zeros are meaningless (in our usual decimal
|
||
notation 0123 is the same as 123), it explains why trailing bits must be zero. Trailing bits may
|
||
occur when the bit-width of a base does not divide 8. Only binary, base4, and hexadecimal don’t
|
||
have trailing bits issues. So let’s consider octal and base64, which have trailing bits in
|
||
similar circumstances:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>data_encoding::{Specification, BASE64_NOPAD};
|
||
<span class="kw">let </span>octal = {
|
||
<span class="kw">let </span><span class="kw-2">mut </span>spec = Specification::new();
|
||
spec.symbols.push_str(<span class="string">"01234567"</span>);
|
||
spec.encoding().unwrap()
|
||
};
|
||
<span class="macro">assert_eq!</span>(BASE64_NOPAD.encode(<span class="string">b"B"</span>), <span class="string">"Qg"</span>);
|
||
<span class="macro">assert_eq!</span>(octal.encode(<span class="string">b"B"</span>), <span class="string">"204"</span>);</code></pre></div>
|
||
<p>We have the following diagram, where the base64 values are written between parentheses:</p>
|
||
<div class="example-wrap"><pre class="language-text"><code>[base64] | Q(16) : g(32) : [has 4 zero trailing bits]
|
||
[ octal] | 2 : 0 : 4 : [has 1 zero trailing bit ]
|
||
|0 1 0 0 0 0 1 0|0 0 0 0
|
||
[ ascii] | B |
|
||
^-^-^-^-- leading zeros / trailing bits</code></pre></div><h3 id="extensions-1"><a class="doc-anchor" href="#extensions-1">§</a>Extensions</h3><h4 id="padding-1"><a class="doc-anchor" href="#padding-1">§</a>Padding</h4>
|
||
<p>For octal and base64, lcm(8, 3) == lcm(8, 6) == 24 bits or 3 bytes. For base32, lcm(8, 5) is 40
|
||
bits or 5 bytes. Let’s consider octal and base64:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>data_encoding::{Specification, BASE64};
|
||
<span class="kw">let </span>octal = {
|
||
<span class="kw">let </span><span class="kw-2">mut </span>spec = Specification::new();
|
||
spec.symbols.push_str(<span class="string">"01234567"</span>);
|
||
spec.padding = <span class="prelude-val">Some</span>(<span class="string">'='</span>);
|
||
spec.encoding().unwrap()
|
||
};
|
||
<span class="comment">// We start encoding but we only have "B" for now.
|
||
</span><span class="macro">assert_eq!</span>(BASE64.encode(<span class="string">b"B"</span>), <span class="string">"Qg=="</span>);
|
||
<span class="macro">assert_eq!</span>(octal.encode(<span class="string">b"B"</span>), <span class="string">"204====="</span>);
|
||
<span class="comment">// Now we have "it".
|
||
</span><span class="macro">assert_eq!</span>(BASE64.encode(<span class="string">b"it"</span>), <span class="string">"aXQ="</span>);
|
||
<span class="macro">assert_eq!</span>(octal.encode(<span class="string">b"it"</span>), <span class="string">"322720=="</span>);
|
||
<span class="comment">// By concatenating everything, we may decode the original data.
|
||
</span><span class="macro">assert_eq!</span>(BASE64.decode(<span class="string">b"Qg==aXQ="</span>).unwrap(), <span class="string">b"Bit"</span>);
|
||
<span class="macro">assert_eq!</span>(octal.decode(<span class="string">b"204=====322720=="</span>).unwrap(), <span class="string">b"Bit"</span>);</code></pre></div>
|
||
<p>We have the following diagrams:</p>
|
||
<div class="example-wrap"><pre class="language-text"><code>[base64] | Q(16) : g(32) : = : = |
|
||
[ octal] | 2 : 0 : 4 : = : = : = : = : = |
|
||
|0 1 0 0 0 0 1 0|. . . . . . . .|. . . . . . . .|
|
||
[ ascii] | B | end of block aligned --^
|
||
^-- beginning of block aligned
|
||
|
||
[base64] | a(26) : X(23) : Q(16) : = |
|
||
[ octal] | 3 : 2 : 2 : 7 : 2 : 0 : = : = |
|
||
|0 1 1 0 1 0 0 1|0 1 1 1 0 1 0 0|. . . . . . . .|
|
||
[ ascii] | i | t |</code></pre></div><h4 id="ignore-characters-when-decoding-1"><a class="doc-anchor" href="#ignore-characters-when-decoding-1">§</a>Ignore characters when decoding</h4>
|
||
<p>The typical use-case is to ignore newlines (<code>\r</code> and <code>\n</code>). But to keep the example small, we
|
||
will ignore spaces.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>spec = data_encoding::HEXLOWER.specification();
|
||
spec.ignore.push_str(<span class="string">" \t"</span>);
|
||
<span class="kw">let </span>base = spec.encoding().unwrap();
|
||
<span class="macro">assert_eq!</span>(base.decode(<span class="string">b"42 69 74"</span>), base.decode(<span class="string">b"426974"</span>));</code></pre></div>
|
||
<h4 id="wrap-output-when-encoding-1"><a class="doc-anchor" href="#wrap-output-when-encoding-1">§</a>Wrap output when encoding</h4>
|
||
<p>The typical use-case is to wrap after 64 or 76 characters with a newline (<code>\r\n</code> or <code>\n</code>). But
|
||
to keep the example small, we will wrap after 8 characters with a space.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>spec = data_encoding::BASE64.specification();
|
||
spec.wrap.width = <span class="number">8</span>;
|
||
spec.wrap.separator.push_str(<span class="string">" "</span>);
|
||
<span class="kw">let </span>base64 = spec.encoding().unwrap();
|
||
<span class="macro">assert_eq!</span>(base64.encode(<span class="string">b"Hey you"</span>), <span class="string">"SGV5IHlv dQ== "</span>);</code></pre></div>
|
||
<p>Note that the output always ends with the separator.</p>
|
||
<h4 id="translate-characters-when-decoding-1"><a class="doc-anchor" href="#translate-characters-when-decoding-1">§</a>Translate characters when decoding</h4>
|
||
<p>The typical use-case is to translate lowercase to uppercase or reciprocally, but it is also used
|
||
for letters that look alike, like <code>O0</code> or <code>Il1</code>. Let’s illustrate both examples.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>spec = data_encoding::HEXLOWER.specification();
|
||
spec.translate.from.push_str(<span class="string">"ABCDEFOIl"</span>);
|
||
spec.translate.to.push_str(<span class="string">"abcdef011"</span>);
|
||
<span class="kw">let </span>base = spec.encoding().unwrap();
|
||
<span class="macro">assert_eq!</span>(base.decode(<span class="string">b"BOIl"</span>), base.decode(<span class="string">b"b011"</span>));</code></pre></div>
|
||
</div></details><h2 id="fields" class="fields section-header">Fields<a href="#fields" class="anchor">§</a></h2><span id="structfield.symbols" class="structfield section-header"><a href="#structfield.symbols" class="anchor field">§</a><code>symbols: <a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></code></span><div class="docblock"><p>Symbols</p>
|
||
<p>The number of symbols must be 2, 4, 8, 16, 32, or 64. Symbols must be ASCII characters
|
||
(smaller than 128) and they must be unique.</p>
|
||
</div><span id="structfield.bit_order" class="structfield section-header"><a href="#structfield.bit_order" class="anchor field">§</a><code>bit_order: <a class="enum" href="enum.BitOrder.html" title="enum data_encoding::BitOrder">BitOrder</a></code></span><div class="docblock"><p>Bit-order</p>
|
||
<p>The default is to use most significant bit first since it is the most common.</p>
|
||
</div><span id="structfield.check_trailing_bits" class="structfield section-header"><a href="#structfield.check_trailing_bits" class="anchor field">§</a><code>check_trailing_bits: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.bool.html">bool</a></code></span><div class="docblock"><p>Check trailing bits</p>
|
||
<p>The default is to check trailing bits. This field is ignored when unnecessary (i.e. for
|
||
base2, base4, and base16).</p>
|
||
</div><span id="structfield.padding" class="structfield section-header"><a href="#structfield.padding" class="anchor field">§</a><code>padding: <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.char.html">char</a>></code></span><div class="docblock"><p>Padding</p>
|
||
<p>The default is to not use padding. The padding character must be ASCII and must not be a
|
||
symbol.</p>
|
||
</div><span id="structfield.ignore" class="structfield section-header"><a href="#structfield.ignore" class="anchor field">§</a><code>ignore: <a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></code></span><div class="docblock"><p>Characters to ignore when decoding</p>
|
||
<p>The default is to not ignore characters when decoding. The characters to ignore must be
|
||
ASCII and must not be symbols or the padding character.</p>
|
||
</div><span id="structfield.wrap" class="structfield section-header"><a href="#structfield.wrap" class="anchor field">§</a><code>wrap: <a class="struct" href="struct.Wrap.html" title="struct data_encoding::Wrap">Wrap</a></code></span><div class="docblock"><p>How to wrap the output when encoding</p>
|
||
<p>The default is to not wrap the output when encoding. The wrapping characters must be ASCII
|
||
and must not be symbols or the padding character.</p>
|
||
</div><span id="structfield.translate" class="structfield section-header"><a href="#structfield.translate" class="anchor field">§</a><code>translate: <a class="struct" href="struct.Translate.html" title="struct data_encoding::Translate">Translate</a></code></span><div class="docblock"><p>How to translate characters when decoding</p>
|
||
<p>The default is to not translate characters when decoding. The characters to translate from
|
||
must be ASCII and must not have already been assigned a semantics. The characters to
|
||
translate to must be ASCII and must have been assigned a semantics (symbol, padding
|
||
character, or ignored character).</p>
|
||
</div><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Specification" class="impl"><a class="src rightside" href="../src/data_encoding/lib.rs.html#1726-1835">Source</a><a href="#impl-Specification" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Specification.html" title="struct data_encoding::Specification">Specification</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../src/data_encoding/lib.rs.html#1729-1739">Source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> <a class="struct" href="struct.Specification.html" title="struct data_encoding::Specification">Specification</a></h4></section></summary><div class="docblock"><p>Returns a default specification</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.encoding" class="method"><a class="src rightside" href="../src/data_encoding/lib.rs.html#1746-1834">Source</a><h4 class="code-header">pub fn <a href="#method.encoding" class="fn">encoding</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Encoding.html" title="struct data_encoding::Encoding">Encoding</a>, <a class="struct" href="struct.SpecificationError.html" title="struct data_encoding::SpecificationError">SpecificationError</a>></h4></section></summary><div class="docblock"><p>Returns the specified encoding</p>
|
||
<h5 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h5>
|
||
<p>Returns an error if the specification is invalid.</p>
|
||
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Clone-for-Specification" class="impl"><a class="src rightside" href="../src/data_encoding/lib.rs.html#1160">Source</a><a href="#impl-Clone-for-Specification" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.Specification.html" title="struct data_encoding::Specification">Specification</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl"><a class="src rightside" href="../src/data_encoding/lib.rs.html#1160">Source</a><a href="#method.clone" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&self) -> <a class="struct" href="struct.Specification.html" title="struct data_encoding::Specification">Specification</a></h4></section></summary><div class='docblock'>Returns a copy of the value. <a href="https://doc.rust-lang.org/1.84.0/core/clone/trait.Clone.html#tymethod.clone">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.84.0/src/core/clone.rs.html#174">Source</a></span><a href="#method.clone_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/clone/trait.Clone.html#method.clone_from" class="fn">clone_from</a>(&mut self, source: &Self)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/1.84.0/core/clone/trait.Clone.html#method.clone_from">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-Specification" class="impl"><a class="src rightside" href="../src/data_encoding/lib.rs.html#1160">Source</a><a href="#impl-Debug-for-Specification" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Specification.html" title="struct data_encoding::Specification">Specification</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../src/data_encoding/lib.rs.html#1160">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.84.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.84.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.84.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-Specification" class="impl"><a class="src rightside" href="../src/data_encoding/lib.rs.html#1208-1212">Source</a><a href="#impl-Default-for-Specification" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.Specification.html" title="struct data_encoding::Specification">Specification</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="src rightside" href="../src/data_encoding/lib.rs.html#1209-1211">Source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -> Self</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.84.0/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-Specification" class="impl"><a href="#impl-Freeze-for-Specification" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.Specification.html" title="struct data_encoding::Specification">Specification</a></h3></section><section id="impl-RefUnwindSafe-for-Specification" class="impl"><a href="#impl-RefUnwindSafe-for-Specification" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Specification.html" title="struct data_encoding::Specification">Specification</a></h3></section><section id="impl-Send-for-Specification" class="impl"><a href="#impl-Send-for-Specification" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Specification.html" title="struct data_encoding::Specification">Specification</a></h3></section><section id="impl-Sync-for-Specification" class="impl"><a href="#impl-Sync-for-Specification" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Specification.html" title="struct data_encoding::Specification">Specification</a></h3></section><section id="impl-Unpin-for-Specification" class="impl"><a href="#impl-Unpin-for-Specification" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Specification.html" title="struct data_encoding::Specification">Specification</a></h3></section><section id="impl-UnwindSafe-for-Specification" class="impl"><a href="#impl-UnwindSafe-for-Specification" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Specification.html" title="struct data_encoding::Specification">Specification</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/any.rs.html#138">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/any.rs.html#139">Source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.84.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.84.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/borrow.rs.html#209">Source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/borrow.rs.html#211">Source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/borrow.rs.html#217">Source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/borrow.rs.html#218">Source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.84.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-CloneToUninit-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/clone.rs.html#273">Source</a><a href="#impl-CloneToUninit-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/clone/trait.CloneToUninit.html" title="trait core::clone::CloneToUninit">CloneToUninit</a> for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone_to_uninit" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/clone.rs.html#275">Source</a><a href="#method.clone_to_uninit" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="https://doc.rust-lang.org/1.84.0/core/clone/trait.CloneToUninit.html#tymethod.clone_to_uninit" class="fn">clone_to_uninit</a>(&self, dst: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.u8.html">u8</a>)</h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>clone_to_uninit</code>)</span></div></span><div class='docblock'>Performs copy-assignment from <code>self</code> to <code>dst</code>. <a href="https://doc.rust-lang.org/1.84.0/core/clone/trait.CloneToUninit.html#tymethod.clone_to_uninit">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#765">Source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#768">Source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -> T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#748-750">Source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#758">Source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -> U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
|
||
<p>That is, this conversion is whatever the implementation of
|
||
<code><a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToOwned-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/alloc/borrow.rs.html#82-84">Source</a><a href="#impl-ToOwned-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.84.0/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/alloc/borrow.rs.html#86">Source</a><a href="#associatedtype.Owned" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.84.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/alloc/borrow.rs.html#87">Source</a><a href="#method.to_owned" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fn">to_owned</a>(&self) -> T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/1.84.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/alloc/borrow.rs.html#91">Source</a><a href="#method.clone_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fn">clone_into</a>(&self, target: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&mut T</a>)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/1.84.0/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#805-807">Source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#809">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#812">Source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#790-792">Source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#794">Source</a><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.0/src/core/convert/mod.rs.html#797">Source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html> |