blob: 80754b754315bb2af5f5eb3add320b9308cfe2fd [file] [log] [blame]
<!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="A reader object for BER/DER-encoded ASN.1 data."><meta name="keywords" content="rust, rustlang, rust-lang, BERReader"><title>BERReader in yasna - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../normalize.css"><link rel="stylesheet" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../ayu.css" disabled><link rel="stylesheet" href="../dark.css" disabled><link rel="stylesheet" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.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">&#9776;</button><a class="sidebar-logo" href="../yasna/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../yasna/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">BERReader</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block"><li><a href="#method.collect_sequence_of">collect_sequence_of</a></li><li><a href="#method.collect_set_of">collect_set_of</a></li><li><a href="#method.lookahead_tag">lookahead_tag</a></li><li><a href="#method.mode">mode</a></li><li><a href="#method.read_bigint">read_bigint</a></li><li><a href="#method.read_biguint">read_biguint</a></li><li><a href="#method.read_bitvec">read_bitvec</a></li><li><a href="#method.read_bitvec_bytes">read_bitvec_bytes</a></li><li><a href="#method.read_bmp_string">read_bmp_string</a></li><li><a href="#method.read_bool">read_bool</a></li><li><a href="#method.read_bytes">read_bytes</a></li><li><a href="#method.read_der">read_der</a></li><li><a href="#method.read_enum">read_enum</a></li><li><a href="#method.read_generalized_time">read_generalized_time</a></li><li><a href="#method.read_i16">read_i16</a></li><li><a href="#method.read_i32">read_i32</a></li><li><a href="#method.read_i64">read_i64</a></li><li><a href="#method.read_i8">read_i8</a></li><li><a href="#method.read_ia5_string">read_ia5_string</a></li><li><a href="#method.read_null">read_null</a></li><li><a href="#method.read_numeric_string">read_numeric_string</a></li><li><a href="#method.read_oid">read_oid</a></li><li><a href="#method.read_printable_string">read_printable_string</a></li><li><a href="#method.read_sequence">read_sequence</a></li><li><a href="#method.read_sequence_of">read_sequence_of</a></li><li><a href="#method.read_set">read_set</a></li><li><a href="#method.read_set_of">read_set_of</a></li><li><a href="#method.read_tagged">read_tagged</a></li><li><a href="#method.read_tagged_der">read_tagged_der</a></li><li><a href="#method.read_tagged_implicit">read_tagged_implicit</a></li><li><a href="#method.read_u16">read_u16</a></li><li><a href="#method.read_u32">read_u32</a></li><li><a href="#method.read_u64">read_u64</a></li><li><a href="#method.read_u8">read_u8</a></li><li><a href="#method.read_utctime">read_utctime</a></li><li><a href="#method.read_utf8string">read_utf8string</a></li><li><a href="#method.read_visible_string">read_visible_string</a></li><li><a href="#method.read_with_buffer">read_with_buffer</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block"><li><a href="#impl-Debug-for-BERReader%3C%27a%2C%20%27b%3E">Debug</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block"><li><a href="#impl-RefUnwindSafe-for-BERReader%3C%27a%2C%20%27b%3E">RefUnwindSafe</a></li><li><a href="#impl-Send-for-BERReader%3C%27a%2C%20%27b%3E">Send</a></li><li><a href="#impl-Sync-for-BERReader%3C%27a%2C%20%27b%3E">Sync</a></li><li><a href="#impl-Unpin-for-BERReader%3C%27a%2C%20%27b%3E">Unpin</a></li><li><a href="#impl-UnwindSafe-for-BERReader%3C%27a%2C%20%27b%3E">!UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block"><li><a href="#impl-Any-for-BERReader%3C%27a%2C%20%27b%3E">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-BERReader%3C%27a%2C%20%27b%3E">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-BERReader%3C%27a%2C%20%27b%3E">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-From%3CT%3E-for-BERReader%3C%27a%2C%20%27b%3E">From&lt;T&gt;</a></li><li><a href="#impl-Into%3CU%3E-for-BERReader%3C%27a%2C%20%27b%3E">Into&lt;U&gt;</a></li><li><a href="#impl-TryFrom%3CU%3E-for-BERReader%3C%27a%2C%20%27b%3E">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-BERReader%3C%27a%2C%20%27b%3E">TryInto&lt;U&gt;</a></li></ul></section><h2><a href="index.html">In yasna</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" 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="../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Struct <a href="index.html">yasna</a>::<wbr><a class="struct" href="#">BERReader</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/yasna/reader/mod.rs.html#423-426">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="item-decl"><pre class="rust struct"><code>pub struct BERReader&lt;'a, 'b&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;'a: 'b,</span>{ /* private fields */ }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A reader object for BER/DER-encoded ASN.1 data.</p>
<p>The two main sources of <code>BERReaderSeq</code> are:</p>
<ul>
<li>The <a href="fn.parse_ber.html"><code>parse_ber</code></a>/<a href="fn.parse_der.html"><code>parse_der</code></a> function,
the starting point of DER serialization.</li>
<li>The <code>next</code> method of <a href="struct.BERReaderSeq.html"><code>BERReaderSeq</code></a>.</li>
</ul>
<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>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">2</span>, <span class="number">1</span>, <span class="number">10</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.read_i64()
}).unwrap();
<span class="macro">assert_eq!</span>(asn, <span class="number">10</span>);</code></pre></div>
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><div id="implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-BERReader%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#428-1642">source</a><a href="#impl-BERReader%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">impl&lt;'a, 'b&gt; <a class="struct" href="struct.BERReader.html" title="struct yasna::BERReader">BERReader</a>&lt;'a, 'b&gt;</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.mode" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#443-445">source</a><h4 class="code-header">pub fn <a href="#method.mode" class="fnname">mode</a>(&amp;self) -&gt; <a class="enum" href="enum.BERMode.html" title="enum yasna::BERMode">BERMode</a></h4></section></summary><div class="docblock"><p>Tells which format we are parsing, BER or DER.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_bool" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#459-477">source</a><h4 class="code-header">pub fn <a href="#method.read_bool" class="fnname">read_bool</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;bool&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 BOOLEAN value as <code>bool</code>.</p>
<h5 id="examples-1"><a href="#examples-1">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">255</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.read_bool()
}).unwrap();
<span class="macro">assert_eq!</span>(asn, <span class="bool-val">true</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_enum" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#523-525">source</a><h4 class="code-header">pub fn <a href="#method.read_enum" class="fnname">read_enum</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;i64&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 ENUMERATED value as <code>i64</code>.</p>
<h5 id="examples-2"><a href="#examples-2">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">1</span>, <span class="number">13</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.read_enum()
}).unwrap();
<span class="macro">assert_eq!</span>(asn, <span class="number">13</span>);</code></pre></div>
<h5 id="errors"><a href="#errors">Errors</a></h5>
<p>Except parse errors, it can raise integer overflow errors.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_i64" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#543-545">source</a><h4 class="code-header">pub fn <a href="#method.read_i64" class="fnname">read_i64</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;i64&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 INTEGER value as <code>i64</code>.</p>
<h5 id="examples-3"><a href="#examples-3">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">2</span>, <span class="number">4</span>, <span class="number">73</span>, <span class="number">150</span>, <span class="number">2</span>, <span class="number">210</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.read_i64()
}).unwrap();
<span class="macro">assert_eq!</span>(asn, <span class="number">1234567890</span>);</code></pre></div>
<h5 id="errors-1"><a href="#errors-1">Errors</a></h5>
<p>Except parse errors, it can raise integer overflow errors.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_u64" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#552-580">source</a><h4 class="code-header">pub fn <a href="#method.read_u64" class="fnname">read_u64</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;u64&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 INTEGER value as <code>u64</code>.</p>
<h5 id="errors-2"><a href="#errors-2">Errors</a></h5>
<p>Except parse errors, it can raise integer overflow errors.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_i32" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#587-594">source</a><h4 class="code-header">pub fn <a href="#method.read_i32" class="fnname">read_i32</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;i32&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 INTEGER value as <code>i32</code>.</p>
<h5 id="errors-3"><a href="#errors-3">Errors</a></h5>
<p>Except parse errors, it can raise integer overflow errors.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_u32" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#601-608">source</a><h4 class="code-header">pub fn <a href="#method.read_u32" class="fnname">read_u32</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;u32&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 INTEGER value as <code>u32</code>.</p>
<h5 id="errors-4"><a href="#errors-4">Errors</a></h5>
<p>Except parse errors, it can raise integer overflow errors.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_i16" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#615-622">source</a><h4 class="code-header">pub fn <a href="#method.read_i16" class="fnname">read_i16</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;i16&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 INTEGER value as <code>i16</code>.</p>
<h5 id="errors-5"><a href="#errors-5">Errors</a></h5>
<p>Except parse errors, it can raise integer overflow errors.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_u16" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#629-636">source</a><h4 class="code-header">pub fn <a href="#method.read_u16" class="fnname">read_u16</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;u16&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 INTEGER value as <code>u16</code>.</p>
<h5 id="errors-6"><a href="#errors-6">Errors</a></h5>
<p>Except parse errors, it can raise integer overflow errors.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_i8" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#643-650">source</a><h4 class="code-header">pub fn <a href="#method.read_i8" class="fnname">read_i8</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;i8&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 INTEGER value as <code>i8</code>.</p>
<h5 id="errors-7"><a href="#errors-7">Errors</a></h5>
<p>Except parse errors, it can raise integer overflow errors.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_u8" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#657-664">source</a><h4 class="code-header">pub fn <a href="#method.read_u8" class="fnname">read_u8</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;u8&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 INTEGER value as <code>u8</code>.</p>
<h5 id="errors-8"><a href="#errors-8">Errors</a></h5>
<p>Except parse errors, it can raise integer overflow errors.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_bigint" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#693-724">source</a><h4 class="code-header">pub fn <a href="#method.read_bigint" class="fnname">read_bigint</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;<a class="struct" href="../num_bigint/bigint/struct.BigInt.html" title="struct num_bigint::bigint::BigInt">BigInt</a>&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 INTEGER value as <code>BigInt</code>.</p>
<h5 id="examples-4"><a href="#examples-4">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">use </span>num_bigint::BigInt;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">2</span>, <span class="number">4</span>, <span class="number">73</span>, <span class="number">150</span>, <span class="number">2</span>, <span class="number">210</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.read_bigint()
}).unwrap();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>asn, <span class="kw-2">&amp;</span>BigInt::parse_bytes(<span class="string">b&quot;1234567890&quot;</span>, <span class="number">10</span>).unwrap());</code></pre></div>
<h5 id="features"><a href="#features">Features</a></h5>
<p>This method is enabled by <code>num</code> feature.</p>
<div class="example-wrap"><pre class="language-toml"><code>[dependencies]
yasna = { version = &quot;*&quot;, features = [&quot;num&quot;] }</code></pre></div></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_biguint" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#741-764">source</a><h4 class="code-header">pub fn <a href="#method.read_biguint" class="fnname">read_biguint</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;<a class="struct" href="../num_bigint/biguint/struct.BigUint.html" title="struct num_bigint::biguint::BigUint">BigUint</a>&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 INTEGER value as <code>BigUint</code>.</p>
<h5 id="errors-9"><a href="#errors-9">Errors</a></h5>
<p>Except parse errors, it can raise integer overflow errors.</p>
<h5 id="features-1"><a href="#features-1">Features</a></h5>
<p>This method is enabled by <code>num</code> feature.</p>
<div class="example-wrap"><pre class="language-toml"><code>[dependencies]
yasna = { version = &quot;*&quot;, features = [&quot;num&quot;] }</code></pre></div></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_bitvec" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#845-850">source</a><h4 class="code-header">pub fn <a href="#method.read_bitvec" class="fnname">read_bitvec</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;<a class="struct" href="../bit_vec/struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a>&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 BITSTRING value as <code>BitVec</code>.</p>
<h5 id="examples-5"><a href="#examples-5">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">use </span>bit_vec::BitVec;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">3</span>, <span class="number">5</span>, <span class="number">3</span>, <span class="number">206</span>, <span class="number">213</span>, <span class="number">116</span>, <span class="number">24</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.read_bitvec()
}).unwrap();
<span class="macro">assert_eq!</span>(
asn.into_iter().map(|b| b <span class="kw">as </span>usize).collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;(),
<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>,
<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>]);</code></pre></div>
<h5 id="features-2"><a href="#features-2">Features</a></h5>
<p>This method is enabled by <code>bit-vec</code> feature.</p>
<div class="example-wrap"><pre class="language-toml"><code>[dependencies]
yasna = { version = &quot;*&quot;, features = [&quot;bit-vec&quot;] }</code></pre></div></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_bitvec_bytes" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#876-882">source</a><h4 class="code-header">pub fn <a href="#method.read_bitvec_bytes" class="fnname">read_bitvec_bytes</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;(Vec&lt;u8&gt;, usize)&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 BITSTRING value as <code>(Vec&lt;u8&gt;, usize)</code>.</p>
<h5 id="examples-6"><a href="#examples-6">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">3</span>, <span class="number">4</span>, <span class="number">6</span>, <span class="number">117</span>, <span class="number">13</span>, <span class="number">64</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.read_bitvec_bytes()
}).unwrap();
<span class="macro">assert_eq!</span>(asn, (<span class="macro">vec!</span>[<span class="number">117</span>, <span class="number">13</span>, <span class="number">64</span>], <span class="number">18</span>));</code></pre></div>
<h5 id="features-3"><a href="#features-3">Features</a></h5>
<p>This method is enabled by <code>bit-vec</code> feature.</p>
<div class="example-wrap"><pre class="language-toml"><code>[dependencies]
yasna = { version = &quot;*&quot;, features = [&quot;bit-vec&quot;] }</code></pre></div></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_bytes" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#922-926">source</a><h4 class="code-header">pub fn <a href="#method.read_bytes" class="fnname">read_bytes</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;Vec&lt;u8&gt;&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 OCTETSTRING value as <code>Vec&lt;u8&gt;</code>.</p>
<h5 id="examples-7"><a href="#examples-7">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">36</span>, <span class="number">128</span>, <span class="number">4</span>, <span class="number">2</span>, <span class="number">72</span>, <span class="number">101</span>, <span class="number">4</span>, <span class="number">4</span>, <span class="number">108</span>, <span class="number">108</span>, <span class="number">111</span>, <span class="number">33</span>, <span class="number">0</span>, <span class="number">0</span>];
<span class="kw">let </span>asn = yasna::parse_ber(data, |reader| {
reader.read_bytes()
}).unwrap();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>asn, <span class="string">b&quot;Hello!&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_null" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#940-953">source</a><h4 class="code-header">pub fn <a href="#method.read_null" class="fnname">read_null</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;()&gt;</h4></section></summary><div class="docblock"><p>Reads the ASN.1 NULL value.</p>
<h5 id="examples-8"><a href="#examples-8">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">5</span>, <span class="number">0</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.read_null()
}).unwrap();
<span class="macro">assert_eq!</span>(asn, ());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_oid" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#967-1007">source</a><h4 class="code-header">pub fn <a href="#method.read_oid" class="fnname">read_oid</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;<a class="struct" href="models/struct.ObjectIdentifier.html" title="struct yasna::models::ObjectIdentifier">ObjectIdentifier</a>&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 object identifier.</p>
<h5 id="examples-9"><a href="#examples-9">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">6</span>, <span class="number">8</span>, <span class="number">42</span>, <span class="number">134</span>, <span class="number">72</span>, <span class="number">134</span>, <span class="number">247</span>, <span class="number">13</span>, <span class="number">1</span>, <span class="number">1</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.read_oid()
}).unwrap();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;*</span>asn.components(), <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">840</span>, <span class="number">113549</span>, <span class="number">1</span>, <span class="number">1</span>]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_utf8string" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1024-1032">source</a><h4 class="code-header">pub fn <a href="#method.read_utf8string" class="fnname">read_utf8string</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;String&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 UTF8String.</p>
<h5 id="examples-10"><a href="#examples-10">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[
<span class="number">12</span>, <span class="number">29</span>, <span class="number">103</span>, <span class="number">110</span>, <span class="number">97</span>, <span class="number">119</span>, <span class="number">32</span>, <span class="number">207</span>, <span class="number">129</span>, <span class="number">206</span>, <span class="number">191</span>, <span class="number">206</span>,
<span class="number">186</span>, <span class="number">206</span>, <span class="number">177</span>, <span class="number">206</span>, <span class="number">189</span>, <span class="number">206</span>, <span class="number">175</span>, <span class="number">206</span>, <span class="number">182</span>, <span class="number">207</span>,
<span class="number">137</span>, <span class="number">32</span>, <span class="number">240</span>, <span class="number">170</span>, <span class="number">152</span>, <span class="number">130</span>, <span class="number">227</span>, <span class="number">130</span>, <span class="number">139</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.read_utf8string()
}).unwrap();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>asn, <span class="string">&quot;gnaw ροκανίζω 𪘂る&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_sequence" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1056-1068">source</a><h4 class="code-header">pub fn <a href="#method.read_sequence" class="fnname">read_sequence</a>&lt;T, F&gt;(self, callback: F) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;T&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: for&lt;'c&gt; FnOnce(&amp;mut <a class="struct" href="struct.BERReaderSeq.html" title="struct yasna::BERReaderSeq">BERReaderSeq</a>&lt;'a, 'c&gt;) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;T&gt;,</span></h4></section></summary><div class="docblock"><p>Reads an ASN.1 SEQUENCE value.</p>
<p>This function uses the loan pattern: <code>callback</code> is called back with
a <a href="struct.BERReaderSeq.html"><code>BERReaderSeq</code></a>, from which the contents of the
SEQUENCE is read.</p>
<h5 id="examples-11"><a href="#examples-11">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">48</span>, <span class="number">6</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">10</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">255</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.read_sequence(|reader| {
<span class="kw">let </span>i = <span class="macro">try!</span>(reader.next().read_i64());
<span class="kw">let </span>b = <span class="macro">try!</span>(reader.next().read_bool());
<span class="kw">return </span><span class="prelude-val">Ok</span>((i, b));
})
}).unwrap();
<span class="macro">assert_eq!</span>(asn, (<span class="number">10</span>, <span class="bool-val">true</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_sequence_of" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1096-1108">source</a><h4 class="code-header">pub fn <a href="#method.read_sequence_of" class="fnname">read_sequence_of</a>&lt;F&gt;(self, callback: F) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;()&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: for&lt;'c&gt; FnMut(<a class="struct" href="struct.BERReader.html" title="struct yasna::BERReader">BERReader</a>&lt;'a, 'c&gt;) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;()&gt;,</span></h4></section></summary><div class="docblock"><p>Reads an ASN.1 SEQUENCE OF value.</p>
<p>This function uses the loan pattern: <code>callback</code> is called back with
a [<code>BERReader</code>][berreader], from which the contents of the
SEQUENCE OF is read.</p>
<p>This function doesn’t return values. Instead, use mutable values to
maintain read values. <code>collect_set_of</code> can be an alternative.</p>
<h5 id="examples-12"><a href="#examples-12">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">48</span>, <span class="number">7</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">10</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">255</span>, <span class="number">127</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
<span class="kw">let </span><span class="kw-2">mut </span>numbers = Vec::new();
<span class="macro">try!</span>(reader.read_sequence_of(|reader| {
numbers.push(<span class="macro">try!</span>(reader.read_i64()));
<span class="kw">return </span><span class="prelude-val">Ok</span>(());
}));
<span class="kw">return </span><span class="prelude-val">Ok</span>(numbers);
}).unwrap();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>asn, <span class="kw-2">&amp;</span>[<span class="number">10</span>, -<span class="number">129</span>]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.collect_sequence_of" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1132-1141">source</a><h4 class="code-header">pub fn <a href="#method.collect_sequence_of" class="fnname">collect_sequence_of</a>&lt;T, F&gt;(self, callback: F) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;Vec&lt;T&gt;&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: for&lt;'c&gt; FnMut(<a class="struct" href="struct.BERReader.html" title="struct yasna::BERReader">BERReader</a>&lt;'a, 'c&gt;) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;T&gt;,</span></h4></section></summary><div class="docblock"><p>Collects an ASN.1 SEQUENCE OF value.</p>
<p>This function uses the loan pattern: <code>callback</code> is called back with
a <a href="struct.BERReader.html"><code>BERReader</code></a>, from which the contents of the
SEQUENCE OF is read.</p>
<p>If you don’t like <code>Vec</code>, you can use <code>read_sequence_of</code> instead.</p>
<h5 id="examples-13"><a href="#examples-13">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">48</span>, <span class="number">7</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">10</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">255</span>, <span class="number">127</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.collect_sequence_of(|reader| {
reader.read_i64()
})
}).unwrap();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>asn, <span class="kw-2">&amp;</span>[<span class="number">10</span>, -<span class="number">129</span>]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_set" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1168-1208">source</a><h4 class="code-header">pub fn <a href="#method.read_set" class="fnname">read_set</a>&lt;T, F&gt;(self, callback: F) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;T&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: for&lt;'c&gt; FnOnce(&amp;mut <a class="struct" href="struct.BERReaderSet.html" title="struct yasna::BERReaderSet">BERReaderSet</a>&lt;'a, 'c&gt;) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;T&gt;,</span></h4></section></summary><div class="docblock"><p>Reads an ASN.1 SET value.</p>
<p>This function uses the loan pattern: <code>callback</code> is called back with
a <a href="struct.BERReaderSet.html"><code>BERReaderSet</code></a>, from which the contents of the
SET are read.</p>
<p>For SET OF values, use <code>read_set_of</code> instead.</p>
<h5 id="examples-14"><a href="#examples-14">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">use </span>yasna::tags::{TAG_INTEGER,TAG_BOOLEAN};
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">49</span>, <span class="number">6</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">255</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">10</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.read_set(|reader| {
<span class="kw">let </span>i = <span class="macro">try!</span>(<span class="macro">try!</span>(reader.next(<span class="kw-2">&amp;</span>[TAG_INTEGER])).read_i64());
<span class="kw">let </span>b = <span class="macro">try!</span>(<span class="macro">try!</span>(reader.next(<span class="kw-2">&amp;</span>[TAG_BOOLEAN])).read_bool());
<span class="kw">return </span><span class="prelude-val">Ok</span>((i, b));
})
}).unwrap();
<span class="macro">assert_eq!</span>(asn, (<span class="number">10</span>, <span class="bool-val">true</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_set_of" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1241-1265">source</a><h4 class="code-header">pub fn <a href="#method.read_set_of" class="fnname">read_set_of</a>&lt;F&gt;(self, callback: F) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;()&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: for&lt;'c&gt; FnMut(<a class="struct" href="struct.BERReader.html" title="struct yasna::BERReader">BERReader</a>&lt;'a, 'c&gt;) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;()&gt;,</span></h4></section></summary><div class="docblock"><p>Reads an ASN.1 SET OF value.</p>
<p>This function uses the loan pattern: <code>callback</code> is called back with
a <a href="struct.BERReader.html"><code>BERReader</code></a>, from which the contents of the
SET OF are read.</p>
<p>This function doesn’t return values. Instead, use mutable values to
maintain read values. <code>collect_set_of</code> can be an alternative.</p>
<p>This function doesn’t sort the elements. In DER, it is assumed that
the elements occur in an order determined by DER encodings of them.</p>
<p>For SET values, use <code>read_set</code> instead.</p>
<h5 id="examples-15"><a href="#examples-15">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">49</span>, <span class="number">7</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">10</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">255</span>, <span class="number">127</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
<span class="kw">let </span><span class="kw-2">mut </span>numbers = Vec::new();
<span class="macro">try!</span>(reader.read_set_of(|reader| {
numbers.push(<span class="macro">try!</span>(reader.read_i64()));
<span class="kw">return </span><span class="prelude-val">Ok</span>(());
}));
<span class="kw">return </span><span class="prelude-val">Ok</span>(numbers);
}).unwrap();
<span class="macro">assert_eq!</span>(asn, <span class="macro">vec!</span>[<span class="number">10</span>, -<span class="number">129</span>]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.collect_set_of" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1292-1300">source</a><h4 class="code-header">pub fn <a href="#method.collect_set_of" class="fnname">collect_set_of</a>&lt;T, F&gt;(self, callback: F) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;Vec&lt;T&gt;&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: for&lt;'c&gt; FnMut(<a class="struct" href="struct.BERReader.html" title="struct yasna::BERReader">BERReader</a>&lt;'a, 'c&gt;) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;T&gt;,</span></h4></section></summary><div class="docblock"><p>Collects an ASN.1 SET OF value.</p>
<p>This function uses the loan pattern: <code>callback</code> is called back with
a <a href="struct.BERReader.html"><code>BERReader</code></a>, from which the contents of the
SET OF is read.</p>
<p>If you don’t like <code>Vec</code>, you can use <code>read_set_of</code> instead.</p>
<p>This function doesn’t sort the elements. In DER, it is assumed that
the elements occur in an order determined by DER encodings of them.</p>
<h5 id="examples-16"><a href="#examples-16">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">49</span>, <span class="number">7</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">10</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">255</span>, <span class="number">127</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.collect_set_of(|reader| {
reader.read_i64()
})
}).unwrap();
<span class="macro">assert_eq!</span>(asn, <span class="macro">vec!</span>[<span class="number">10</span>, -<span class="number">129</span>]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_numeric_string" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1314-1324">source</a><h4 class="code-header">pub fn <a href="#method.read_numeric_string" class="fnname">read_numeric_string</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;String&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 NumericString.</p>
<h5 id="examples-17"><a href="#examples-17">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">18</span>, <span class="number">7</span>, <span class="number">49</span>, <span class="number">50</span>, <span class="number">56</span>, <span class="number">32</span>, <span class="number">50</span>, <span class="number">53</span>, <span class="number">54</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.read_numeric_string()
}).unwrap();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>asn, <span class="string">&quot;128 256&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_printable_string" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1338-1353">source</a><h4 class="code-header">pub fn <a href="#method.read_printable_string" class="fnname">read_printable_string</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;String&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 PrintableString.</p>
<h5 id="examples-18"><a href="#examples-18">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">19</span>, <span class="number">9</span>, <span class="number">67</span>, <span class="number">111</span>, <span class="number">46</span>, <span class="number">44</span>, <span class="number">32</span>, <span class="number">76</span>, <span class="number">116</span>, <span class="number">100</span>, <span class="number">46</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.read_printable_string()
}).unwrap();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>asn, <span class="string">&quot;Co., Ltd.&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_ia5_string" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1367-1384">source</a><h4 class="code-header">pub fn <a href="#method.read_ia5_string" class="fnname">read_ia5_string</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;String&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 IA5String.</p>
<h5 id="examples-19"><a href="#examples-19">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">22</span>, <span class="number">9</span>, <span class="number">0x41</span>, <span class="number">0x53</span>, <span class="number">0x43</span>, <span class="number">0x49</span>, <span class="number">0x49</span>, <span class="number">0x20</span>, <span class="number">0x70</span>, <span class="number">0x6C</span>, <span class="number">0x7A</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.read_ia5_string()
}).unwrap();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>asn, <span class="string">&quot;ASCII plz&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_bmp_string" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1398-1410">source</a><h4 class="code-header">pub fn <a href="#method.read_bmp_string" class="fnname">read_bmp_string</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;String&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 BMPString.</p>
<h5 id="examples-20"><a href="#examples-20">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">30</span>, <span class="number">14</span>, <span class="number">0x00</span>, <span class="number">0xA3</span>, <span class="number">0x03</span>, <span class="number">0xC0</span>, <span class="number">0x00</span>, <span class="number">0x20</span>, <span class="number">0x00</span>, <span class="number">0x71</span>, <span class="number">0x00</span>, <span class="number">0x75</span>, <span class="number">0x00</span>, <span class="number">0x75</span>, <span class="number">0x00</span>, <span class="number">0x78</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.read_bmp_string()
}).unwrap();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>asn, <span class="string">&quot;£π quux&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_utctime" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1436-1448">source</a><h4 class="code-header">pub fn <a href="#method.read_utctime" class="fnname">read_utctime</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;<a class="struct" href="models/struct.UTCTime.html" title="struct yasna::models::UTCTime">UTCTime</a>&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 UTCTime.</p>
<h5 id="examples-21"><a href="#examples-21">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[
<span class="number">23</span>, <span class="number">15</span>, <span class="number">56</span>, <span class="number">50</span>, <span class="number">48</span>, <span class="number">49</span>, <span class="number">48</span>, <span class="number">50</span>, <span class="number">48</span>,
<span class="number">55</span>, <span class="number">48</span>, <span class="number">48</span>, <span class="number">45</span>, <span class="number">48</span>, <span class="number">53</span>, <span class="number">48</span>, <span class="number">48</span>];
<span class="kw">let </span>asn = yasna::parse_ber(data, |reader| {
reader.read_utctime()
}).unwrap();
<span class="macro">assert_eq!</span>(asn.datetime().timestamp(), <span class="number">378820800</span>);</code></pre></div>
<h5 id="features-4"><a href="#features-4">Features</a></h5>
<p>This method is enabled by <code>chrono</code> feature.</p>
<div class="example-wrap"><pre class="language-toml"><code>[dependencies]
yasna = { version = &quot;*&quot;, features = [&quot;chrono&quot;] }</code></pre></div></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_generalized_time" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1474-1486">source</a><h4 class="code-header">pub fn <a href="#method.read_generalized_time" class="fnname">read_generalized_time</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;<a class="struct" href="models/struct.GeneralizedTime.html" title="struct yasna::models::GeneralizedTime">GeneralizedTime</a>&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 GeneralizedTime.</p>
<h5 id="examples-22"><a href="#examples-22">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[
<span class="number">24</span>, <span class="number">17</span>, <span class="number">49</span>, <span class="number">57</span>, <span class="number">56</span>, <span class="number">53</span>, <span class="number">49</span>, <span class="number">49</span>, <span class="number">48</span>, <span class="number">54</span>,
<span class="number">50</span>, <span class="number">49</span>, <span class="number">46</span>, <span class="number">49</span>, <span class="number">52</span>, <span class="number">49</span>, <span class="number">53</span>, <span class="number">57</span>, <span class="number">90</span>];
<span class="kw">let </span>asn = yasna::parse_ber(data, |reader| {
reader.read_generalized_time()
}).unwrap();
<span class="macro">assert_eq!</span>(asn.datetime().timestamp(), <span class="number">500159309</span>);</code></pre></div>
<h5 id="features-5"><a href="#features-5">Features</a></h5>
<p>This method is enabled by <code>chrono</code> feature.</p>
<div class="example-wrap"><pre class="language-toml"><code>[dependencies]
yasna = { version = &quot;*&quot;, features = [&quot;chrono&quot;] }</code></pre></div></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_visible_string" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1500-1510">source</a><h4 class="code-header">pub fn <a href="#method.read_visible_string" class="fnname">read_visible_string</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;String&gt;</h4></section></summary><div class="docblock"><p>Reads an ASN.1 VisibleString.</p>
<h5 id="examples-23"><a href="#examples-23">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">26</span>, <span class="number">3</span>, <span class="number">72</span>, <span class="number">105</span>, <span class="number">33</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.read_visible_string()
}).unwrap();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>asn, <span class="string">&quot;Hi!&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_tagged" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1526-1537">source</a><h4 class="code-header">pub fn <a href="#method.read_tagged" class="fnname">read_tagged</a>&lt;T, F&gt;(self, tag: <a class="struct" href="struct.Tag.html" title="struct yasna::Tag">Tag</a>, callback: F) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;T&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: for&lt;'c&gt; FnOnce(<a class="struct" href="struct.BERReader.html" title="struct yasna::BERReader">BERReader</a>&lt;'a, 'c&gt;) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;T&gt;,</span></h4></section></summary><div class="docblock"><p>Reads a (explicitly) tagged value.</p>
<h5 id="examples-24"><a href="#examples-24">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna::{<span class="self">self</span>,Tag};
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">163</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">10</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.read_tagged(Tag::context(<span class="number">3</span>), |reader| {
reader.read_i64()
})
}).unwrap();
<span class="macro">assert_eq!</span>(asn, <span class="number">10</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_tagged_implicit" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1553-1561">source</a><h4 class="code-header">pub fn <a href="#method.read_tagged_implicit" class="fnname">read_tagged_implicit</a>&lt;T, F&gt;(self, tag: <a class="struct" href="struct.Tag.html" title="struct yasna::Tag">Tag</a>, callback: F) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;T&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: for&lt;'c&gt; FnOnce(<a class="struct" href="struct.BERReader.html" title="struct yasna::BERReader">BERReader</a>&lt;'a, 'c&gt;) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;T&gt;,</span></h4></section></summary><div class="docblock"><p>Reads an implicitly tagged value.</p>
<h5 id="examples-25"><a href="#examples-25">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna::{<span class="self">self</span>,Tag};
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">131</span>, <span class="number">1</span>, <span class="number">10</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.read_tagged_implicit(Tag::context(<span class="number">3</span>), |reader| {
reader.read_i64()
})
}).unwrap();
<span class="macro">assert_eq!</span>(asn, <span class="number">10</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.lookahead_tag" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1586-1588">source</a><h4 class="code-header">pub fn <a href="#method.lookahead_tag" class="fnname">lookahead_tag</a>(&amp;self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;<a class="struct" href="struct.Tag.html" title="struct yasna::Tag">Tag</a>&gt;</h4></section></summary><div class="docblock"><p>Lookaheads the tag in the next value. Used to parse CHOICE values.</p>
<h5 id="examples-26"><a href="#examples-26">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">use </span>yasna::tags::<span class="kw-2">*</span>;
<span class="kw">let </span>data = <span class="kw-2">&amp;</span>[<span class="number">48</span>, <span class="number">5</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">10</span>, <span class="number">5</span>, <span class="number">0</span>];
<span class="kw">let </span>asn = yasna::parse_der(data, |reader| {
reader.collect_sequence_of(|reader| {
<span class="kw">let </span>tag = <span class="macro">try!</span>(reader.lookahead_tag());
<span class="kw">let </span>choice;
<span class="kw">if </span>tag == TAG_INTEGER {
choice = <span class="prelude-val">Some</span>(<span class="macro">try!</span>(reader.read_i64()));
} <span class="kw">else </span>{
<span class="macro">try!</span>(reader.read_null());
choice = <span class="prelude-val">None</span>;
}
<span class="kw">return </span><span class="prelude-val">Ok</span>(choice);
})
}).unwrap();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>asn, <span class="kw-2">&amp;</span>[<span class="prelude-val">Some</span>(<span class="number">10</span>), <span class="prelude-val">None</span>]);</code></pre></div>
</div></details><section id="method.read_with_buffer" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1590-1600">source</a><h4 class="code-header">pub fn <a href="#method.read_with_buffer" class="fnname">read_with_buffer</a>&lt;T, F&gt;(self, callback: F) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;(T, &amp;'a [u8])&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: for&lt;'c&gt; FnOnce(<a class="struct" href="struct.BERReader.html" title="struct yasna::BERReader">BERReader</a>&lt;'a, 'c&gt;) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;T&gt;,</span></h4></section><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_tagged_der" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1617-1623">source</a><h4 class="code-header">pub fn <a href="#method.read_tagged_der" class="fnname">read_tagged_der</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;<a class="struct" href="models/struct.TaggedDerValue.html" title="struct yasna::models::TaggedDerValue">TaggedDerValue</a>&gt;</h4></section></summary><div class="docblock"><p>Read an arbitrary (tag, value) pair as a TaggedDerValue.
The length is not included in the returned payload. If the
payload has indefinite-length encoding, the EOC bytes are
included in the returned payload.</p>
<h5 id="examples-27"><a href="#examples-27">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">use </span>yasna::models::TaggedDerValue;
<span class="kw">use </span>yasna::tags::TAG_OCTETSTRING;
<span class="kw">let </span>data = <span class="string">b&quot;\x04\x06Hello!&quot;</span>;
<span class="kw">let </span>res = yasna::parse_der(data, |reader| reader.read_tagged_der()).unwrap();
<span class="macro">assert_eq!</span>(res, TaggedDerValue::from_tag_and_bytes(TAG_OCTETSTRING, <span class="string">b&quot;Hello!&quot;</span>.to_vec()));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_der" class="method has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#1637-1641">source</a><h4 class="code-header">pub fn <a href="#method.read_der" class="fnname">read_der</a>(self) -&gt; <a class="type" href="type.ASN1Result.html" title="type yasna::ASN1Result">ASN1Result</a>&lt;Vec&lt;u8&gt;&gt;</h4></section></summary><div class="docblock"><p>Reads a DER object as raw bytes. Tag and length are included
in the returned buffer. For indefinite length encoding, EOC bytes
are included in the returned buffer as well.</p>
<h5 id="examples-28"><a href="#examples-28">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>yasna;
<span class="kw">let </span>data = <span class="string">b&quot;\x04\x06Hello!&quot;</span>;
<span class="kw">let </span>res = yasna::parse_der(data, |reader| reader.read_der()).unwrap();
<span class="macro">assert_eq!</span>(res, data);</code></pre></div>
</div></details></div></details></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Debug-for-BERReader%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#422">source</a><a href="#impl-Debug-for-BERReader%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">impl&lt;'a, 'b&gt; Debug for <a class="struct" href="struct.BERReader.html" title="struct yasna::BERReader">BERReader</a>&lt;'a, 'b&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;'a: 'b,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/yasna/reader/mod.rs.html#422">source</a><a href="#method.fmt" class="anchor"></a><h4 class="code-header">fn <a class="fnname">fmt</a>(&amp;self, f: &amp;mut Formatter&lt;'_&gt;) -&gt; Result</h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a>Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-BERReader%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a href="#impl-RefUnwindSafe-for-BERReader%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">impl&lt;'a, 'b&gt; RefUnwindSafe for <a class="struct" href="struct.BERReader.html" title="struct yasna::BERReader">BERReader</a>&lt;'a, 'b&gt;</h3></section><section id="impl-Send-for-BERReader%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a href="#impl-Send-for-BERReader%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">impl&lt;'a, 'b&gt; Send for <a class="struct" href="struct.BERReader.html" title="struct yasna::BERReader">BERReader</a>&lt;'a, 'b&gt;</h3></section><section id="impl-Sync-for-BERReader%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a href="#impl-Sync-for-BERReader%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">impl&lt;'a, 'b&gt; Sync for <a class="struct" href="struct.BERReader.html" title="struct yasna::BERReader">BERReader</a>&lt;'a, 'b&gt;</h3></section><section id="impl-Unpin-for-BERReader%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a href="#impl-Unpin-for-BERReader%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">impl&lt;'a, 'b&gt; Unpin for <a class="struct" href="struct.BERReader.html" title="struct yasna::BERReader">BERReader</a>&lt;'a, 'b&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;'a: 'b,</span></h3></section><section id="impl-UnwindSafe-for-BERReader%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a href="#impl-UnwindSafe-for-BERReader%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">impl&lt;'a, 'b&gt; !UnwindSafe for <a class="struct" href="struct.BERReader.html" title="struct yasna::BERReader">BERReader</a>&lt;'a, 'b&gt;</h3></section></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Any-for-BERReader%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a href="#impl-Any-for-BERReader%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; Any for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl has-srclink"><a href="#method.type_id" class="anchor"></a><h4 class="code-header">fn <a class="fnname">type_id</a>(&amp;self) -&gt; TypeId</h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-BERReader%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a href="#impl-Borrow%3CT%3E-for-BERReader%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; Borrow&lt;T&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span><a href="#method.borrow" class="anchor"></a><h4 class="code-header">fn <a class="fnname">borrow</a>(&amp;self) -&gt; &amp;T</h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-BERReader%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a href="#impl-BorrowMut%3CT%3E-for-BERReader%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; BorrowMut&lt;T&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">fn <a class="fnname">borrow_mut</a>(&amp;mut self) -&gt; &amp;mut T</h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-BERReader%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a href="#impl-From%3CT%3E-for-BERReader%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; From&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.from" class="anchor"></a><h4 class="code-header">fn <a class="fnname">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-BERReader%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a href="#impl-Into%3CU%3E-for-BERReader%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; Into&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: From&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">into</a>(self) -&gt; 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>[From]&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-BERReader%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a href="#impl-TryFrom%3CU%3E-for-BERReader%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; TryFrom&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: Into&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = Infallible</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.try_from" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_from</a>(value: U) -&gt; Result&lt;T, &lt;T as TryFrom&lt;U&gt;&gt;::Error&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-BERReader%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a href="#impl-TryInto%3CU%3E-for-BERReader%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; TryInto&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: TryFrom&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = &lt;U as TryFrom&lt;T&gt;&gt;::Error</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.try_into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_into</a>(self) -&gt; Result&lt;U, &lt;U as TryFrom&lt;T&gt;&gt;::Error&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="yasna" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>