This commit is contained in:
2020-01-23 23:13:36 -08:00
parent dcc0df955e
commit 2bc9ebdc6b
31829 changed files with 1229378 additions and 17 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../serde/de/struct.IgnoredAny.html">
</head>
<body>
<p>Redirecting to <a href="../../../serde/de/struct.IgnoredAny.html">../../../serde/de/struct.IgnoredAny.html</a>...</p>
<script>location.replace("../../../serde/de/struct.IgnoredAny.html" + location.search + location.hash);</script>
</body>
</html>

152
doc/serde/de/index.html Normal file
View File

@@ -0,0 +1,152 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `de` mod in crate `serde`."><meta name="keywords" content="rust, rustlang, rust-lang, de"><title>serde::de - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../serde/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><p class='location'>Module de</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li></ul></div><p class='location'><a href='../index.html'>serde</a></p><script>window.sidebarCurrent = {name: 'de', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/serde/de/mod.rs.html#1-2269' title='goto source code'>[src]</a></span><span class='in-band'>Module <a href='../index.html'>serde</a>::<wbr><a class="mod" href=''>de</a></span></h1><div class='docblock'><p>Generic data structure deserialization framework.</p>
<p>The two most important traits in this module are <a href="../trait.Deserialize.html"><code>Deserialize</code></a> and
<a href="../trait.Deserializer.html"><code>Deserializer</code></a>.</p>
<ul>
<li><strong>A type that implements <code>Deserialize</code> is a data structure</strong> that can be
deserialized from any data format supported by Serde, and conversely</li>
<li><strong>A type that implements <code>Deserializer</code> is a data format</strong> that can
deserialize any data structure supported by Serde.</li>
</ul>
<h1 id="the-deserialize-trait" class="section-header"><a href="#the-deserialize-trait">The Deserialize trait</a></h1>
<p>Serde provides <a href="../trait.Deserialize.html"><code>Deserialize</code></a> implementations for many Rust primitive and
standard library types. The complete list is below. All of these can be
deserialized using Serde out of the box.</p>
<p>Additionally, Serde provides a procedural macro called <a href="https://crates.io/crates/serde_derive"><code>serde_derive</code></a> to
automatically generate <a href="../trait.Deserialize.html"><code>Deserialize</code></a> implementations for structs and enums
in your program. See the <a href="https://serde.rs/derive.html">derive section of the manual</a> for how to use this.</p>
<p>In rare cases it may be necessary to implement <a href="../trait.Deserialize.html"><code>Deserialize</code></a> manually for
some type in your program. See the <a href="https://serde.rs/impl-deserialize.html">Implementing <code>Deserialize</code></a> section of
the manual for more about this.</p>
<p>Third-party crates may provide <a href="../trait.Deserialize.html"><code>Deserialize</code></a> implementations for types
that they expose. For example the <a href="https://crates.io/crates/linked-hash-map"><code>linked-hash-map</code></a> crate provides a
<a href="https://docs.rs/linked-hash-map/*/linked_hash_map/struct.LinkedHashMap.html"><code>LinkedHashMap&lt;K, V&gt;</code></a> type that is deserializable by Serde because the
crate provides an implementation of <a href="../trait.Deserialize.html"><code>Deserialize</code></a> for it.</p>
<h1 id="the-deserializer-trait" class="section-header"><a href="#the-deserializer-trait">The Deserializer trait</a></h1>
<p><a href="../trait.Deserializer.html"><code>Deserializer</code></a> implementations are provided by third-party crates, for
example <a href="https://github.com/serde-rs/json"><code>serde_json</code></a>, <a href="https://github.com/dtolnay/serde-yaml"><code>serde_yaml</code></a> and <a href="https://github.com/TyOverby/bincode"><code>bincode</code></a>.</p>
<p>A partial list of well-maintained formats is given on the <a href="https://serde.rs/#data-formats">Serde
website</a>.</p>
<h1 id="implementations-of-deserialize-provided-by-serde" class="section-header"><a href="#implementations-of-deserialize-provided-by-serde">Implementations of Deserialize provided by Serde</a></h1>
<p>This is a slightly different set of types than what is supported for
serialization. Some types can be serialized by Serde but not deserialized.
One example is <code>OsStr</code>.</p>
<ul>
<li><strong>Primitive types</strong>:
<ul>
<li>bool</li>
<li>i8, i16, i32, i64, i128, isize</li>
<li>u8, u16, u32, u64, u128, usize</li>
<li>f32, f64</li>
<li>char</li>
</ul>
</li>
<li><strong>Compound types</strong>:
<ul>
<li>[T; 0] through [T; 32]</li>
<li>tuples up to size 16</li>
</ul>
</li>
<li><strong>Common standard library types</strong>:
<ul>
<li>String</li>
<li>Option&lt;T&gt;</li>
<li>Result&lt;T, E&gt;</li>
<li>PhantomData&lt;T&gt;</li>
</ul>
</li>
<li><strong>Wrapper types</strong>:
<ul>
<li>Box&lt;T&gt;</li>
<li>Box&lt;[T]&gt;</li>
<li>Box&lt;str&gt;</li>
<li>Cow&lt;'a, T&gt;</li>
<li>Cell&lt;T&gt;</li>
<li>RefCell&lt;T&gt;</li>
<li>Mutex&lt;T&gt;</li>
<li>RwLock&lt;T&gt;</li>
<li>Rc&lt;T&gt;<em>(if</em> features = [&quot;rc&quot;] <em>is enabled)</em></li>
<li>Arc&lt;T&gt;<em>(if</em> features = [&quot;rc&quot;] <em>is enabled)</em></li>
</ul>
</li>
<li><strong>Collection types</strong>:
<ul>
<li>BTreeMap&lt;K, V&gt;</li>
<li>BTreeSet&lt;T&gt;</li>
<li>BinaryHeap&lt;T&gt;</li>
<li>HashMap&lt;K, V, H&gt;</li>
<li>HashSet&lt;T, H&gt;</li>
<li>LinkedList&lt;T&gt;</li>
<li>VecDeque&lt;T&gt;</li>
<li>Vec&lt;T&gt;</li>
</ul>
</li>
<li><strong>Zero-copy types</strong>:
<ul>
<li>&amp;str</li>
<li>&amp;[u8]</li>
</ul>
</li>
<li><strong>FFI types</strong>:
<ul>
<li>CString</li>
<li>Box&lt;CStr&gt;</li>
<li>OsString</li>
</ul>
</li>
<li><strong>Miscellaneous standard library types</strong>:
<ul>
<li>Duration</li>
<li>SystemTime</li>
<li>Path</li>
<li>PathBuf</li>
<li>Range&lt;T&gt;</li>
<li>RangeInclusive&lt;T&gt;</li>
<li>Bound&lt;T&gt;</li>
<li>num::NonZero*</li>
<li><code>!</code> <em>(unstable)</em></li>
</ul>
</li>
<li><strong>Net types</strong>:
<ul>
<li>IpAddr</li>
<li>Ipv4Addr</li>
<li>Ipv6Addr</li>
<li>SocketAddr</li>
<li>SocketAddrV4</li>
<li>SocketAddrV6</li>
</ul>
</li>
</ul>
</div><h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2>
<table><tr class='module-item'><td><a class="mod" href="value/index.html" title='serde::de::value mod'>value</a></td><td class='docblock-short'><p>Building blocks for deserializing basic values using the <code>IntoDeserializer</code>
trait.</p>
</td></tr></table><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table><tr class='module-item'><td><a class="struct" href="struct.IgnoredAny.html" title='serde::de::IgnoredAny struct'>IgnoredAny</a></td><td class='docblock-short'><p>An efficient way of discarding data from a deserializer.</p>
</td></tr></table><h2 id='enums' class='section-header'><a href="#enums">Enums</a></h2>
<table><tr class='module-item'><td><a class="enum" href="enum.Unexpected.html" title='serde::de::Unexpected enum'>Unexpected</a></td><td class='docblock-short'><p><code>Unexpected</code> represents an unexpected invocation of any one of the <code>Visitor</code>
trait methods.</p>
</td></tr></table><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
<table><tr class='module-item'><td><a class="trait" href="trait.Deserialize.html" title='serde::de::Deserialize trait'>Deserialize</a></td><td class='docblock-short'><p>A <strong>data structure</strong> that can be deserialized from any data format supported
by Serde.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.DeserializeOwned.html" title='serde::de::DeserializeOwned trait'>DeserializeOwned</a></td><td class='docblock-short'><p>A data structure that can be deserialized without borrowing any data from
the deserializer.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.DeserializeSeed.html" title='serde::de::DeserializeSeed trait'>DeserializeSeed</a></td><td class='docblock-short'><p><code>DeserializeSeed</code> is the stateful form of the <code>Deserialize</code> trait. If you
ever find yourself looking for a way to pass data into a <code>Deserialize</code> impl,
this trait is the way to do it.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.Deserializer.html" title='serde::de::Deserializer trait'>Deserializer</a></td><td class='docblock-short'><p>A <strong>data format</strong> that can deserialize any data structure supported by
Serde.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.EnumAccess.html" title='serde::de::EnumAccess trait'>EnumAccess</a></td><td class='docblock-short'><p>Provides a <code>Visitor</code> access to the data of an enum in the input.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.Error.html" title='serde::de::Error trait'>Error</a></td><td class='docblock-short'><p>The <code>Error</code> trait allows <code>Deserialize</code> implementations to create descriptive
error messages belonging to the <code>Deserializer</code> against which they are
currently running.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.Expected.html" title='serde::de::Expected trait'>Expected</a></td><td class='docblock-short'><p><code>Expected</code> represents an explanation of what data a <code>Visitor</code> was expecting
to receive.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.IntoDeserializer.html" title='serde::de::IntoDeserializer trait'>IntoDeserializer</a></td><td class='docblock-short'><p>Converts an existing value into a <code>Deserializer</code> from which other values can
be deserialized.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.MapAccess.html" title='serde::de::MapAccess trait'>MapAccess</a></td><td class='docblock-short'><p>Provides a <code>Visitor</code> access to each entry of a map in the input.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.SeqAccess.html" title='serde::de::SeqAccess trait'>SeqAccess</a></td><td class='docblock-short'><p>Provides a <code>Visitor</code> access to each element of a sequence in the input.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.VariantAccess.html" title='serde::de::VariantAccess trait'>VariantAccess</a></td><td class='docblock-short'><p><code>VariantAccess</code> is a visitor that is created by the <code>Deserializer</code> and
passed to the <code>Deserialize</code> to deserialize the content of a particular enum
variant.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.Visitor.html" title='serde::de::Visitor trait'>Visitor</a></td><td class='docblock-short'><p>This trait represents a visitor that walks through a deserializer.</p>
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../../";window.currentCrate = "serde";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>

View File

@@ -0,0 +1 @@
initSidebarItems({"enum":[["Unexpected","`Unexpected` represents an unexpected invocation of any one of the `Visitor` trait methods."]],"mod":[["value","Building blocks for deserializing basic values using the `IntoDeserializer` trait."]],"struct":[["IgnoredAny","An efficient way of discarding data from a deserializer."]],"trait":[["Deserialize","A data structure that can be deserialized from any data format supported by Serde."],["DeserializeOwned","A data structure that can be deserialized without borrowing any data from the deserializer."],["DeserializeSeed","`DeserializeSeed` is the stateful form of the `Deserialize` trait. If you ever find yourself looking for a way to pass data into a `Deserialize` impl, this trait is the way to do it."],["Deserializer","A data format that can deserialize any data structure supported by Serde."],["EnumAccess","Provides a `Visitor` access to the data of an enum in the input."],["Error","The `Error` trait allows `Deserialize` implementations to create descriptive error messages belonging to the `Deserializer` against which they are currently running."],["Expected","`Expected` represents an explanation of what data a `Visitor` was expecting to receive."],["IntoDeserializer","Converts an existing value into a `Deserializer` from which other values can be deserialized."],["MapAccess","Provides a `Visitor` access to each entry of a map in the input."],["SeqAccess","Provides a `Visitor` access to each element of a sequence in the input."],["VariantAccess","`VariantAccess` is a visitor that is created by the `Deserializer` and passed to the `Deserialize` to deserialize the content of a particular enum variant."],["Visitor","This trait represents a visitor that walks through a deserializer."]]});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,28 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `DeserializeOwned` trait in crate `serde`."><meta name="keywords" content="rust, rustlang, rust-lang, DeserializeOwned"><title>serde::de::DeserializeOwned - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../serde/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><p class='location'>Trait DeserializeOwned</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='../index.html'>serde</a>::<wbr><a href='index.html'>de</a></p><script>window.sidebarCurrent = {name: 'DeserializeOwned', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/serde/de/mod.rs.html#596' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='../index.html'>serde</a>::<wbr><a href='index.html'>de</a>::<wbr><a class="trait" href=''>DeserializeOwned</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'>pub trait DeserializeOwned: for&lt;'de&gt; <a class="trait" href="../../serde/trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a>&lt;'de&gt; { }</pre></div><div class='docblock'><p>A data structure that can be deserialized without borrowing any data from
the deserializer.</p>
<p>This is primarily useful for trait bounds on functions. For example a
<code>from_str</code> function may be able to deserialize a data structure that borrows
from the input string, but a <code>from_reader</code> function may only deserialize
owned data.</p>
<pre><code class="language-edition2018"># use serde::de::{Deserialize, DeserializeOwned};
# use std::io::{Read, Result};
#
# trait Ignore {
fn from_str&lt;'a, T&gt;(s: &amp;'a str) -&gt; Result&lt;T&gt;
where
T: Deserialize&lt;'a&gt;;
fn from_reader&lt;R, T&gt;(rdr: R) -&gt; Result&lt;T&gt;
where
R: Read,
T: DeserializeOwned;
# }
</code></pre>
<h1 id="lifetime" class="section-header"><a href="#lifetime">Lifetime</a></h1>
<p>The relationship between <code>Deserialize</code> and <code>DeserializeOwned</code> in trait
bounds is explained in more detail on the page <a href="https://serde.rs/lifetimes.html">Understanding deserializer
lifetimes</a>.</p>
</div>
<h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'><h3 id='impl-DeserializeOwned' class='impl'><code class='in-band'>impl&lt;T&gt; DeserializeOwned for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: for&lt;'de&gt; <a class="trait" href="../../serde/trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a>&lt;'de&gt;,&nbsp;</span></code><a href='#impl-DeserializeOwned' class='anchor'></a><a class='srclink' href='../../src/serde/de/mod.rs.html#597' title='goto source code'>[src]</a></h3><div class='impl-items'></div></div><span class='loading-content'>Loading content...</span><script type="text/javascript">window.inlined_types=new Set([]);</script><script type="text/javascript" async
src="../../implementors/serde/de/trait.DeserializeOwned.js">
</script></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../../";window.currentCrate = "serde";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>

View File

@@ -0,0 +1,155 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `DeserializeSeed` trait in crate `serde`."><meta name="keywords" content="rust, rustlang, rust-lang, DeserializeSeed"><title>serde::de::DeserializeSeed - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../serde/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><p class='location'>Trait DeserializeSeed</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#associated-types">Associated Types</a><div class="sidebar-links"><a href="#associatedtype.Value">Value</a></div><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.deserialize">deserialize</a></div><a class="sidebar-title" href="#foreign-impls">Implementations on Foreign Types</a><div class="sidebar-links"><a href="#impl-DeserializeSeed%3C%27de%3E-for-PhantomData%3CT%3E">PhantomData&lt;T&gt;</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='../index.html'>serde</a>::<wbr><a href='index.html'>de</a></p><script>window.sidebarCurrent = {name: 'DeserializeSeed', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/serde/de/mod.rs.html#757-766' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='../index.html'>serde</a>::<wbr><a href='index.html'>de</a>::<wbr><a class="trait" href=''>DeserializeSeed</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'>pub trait DeserializeSeed&lt;'de&gt;: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
type <a href='#associatedtype.Value' class="type">Value</a>;
fn <a href='#tymethod.deserialize' class='fnname'>deserialize</a>&lt;D&gt;(self, deserializer: D) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="type" href="../../serde/de/trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>, D::<a class="type" href="../../serde/trait.Deserializer.html#associatedtype.Error" title="type serde::Deserializer::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;D: <a class="trait" href="../../serde/trait.Deserializer.html" title="trait serde::Deserializer">Deserializer</a>&lt;'de&gt;</span>;
}</pre></div><div class='docblock'><p><code>DeserializeSeed</code> is the stateful form of the <code>Deserialize</code> trait. If you
ever find yourself looking for a way to pass data into a <code>Deserialize</code> impl,
this trait is the way to do it.</p>
<p>As one example of stateful deserialization consider deserializing a JSON
array into an existing buffer. Using the <code>Deserialize</code> trait we could
deserialize a JSON array into a <code>Vec&lt;T&gt;</code> but it would be a freshly allocated
<code>Vec&lt;T&gt;</code>; there is no way for <code>Deserialize</code> to reuse a previously allocated
buffer. Using <code>DeserializeSeed</code> instead makes this possible as in the
example code below.</p>
<p>The canonical API for stateless deserialization looks like this:</p>
<pre><code class="language-edition2018"># use serde::Deserialize;
#
# enum Error {}
#
fn func&lt;'de, T: Deserialize&lt;'de&gt;&gt;() -&gt; Result&lt;T, Error&gt;
# {
# unimplemented!()
# }
</code></pre>
<p>Adjusting an API like this to support stateful deserialization is a matter
of accepting a seed as input:</p>
<pre><code class="language-edition2018"># use serde::de::DeserializeSeed;
#
# enum Error {}
#
fn func_seed&lt;'de, T: DeserializeSeed&lt;'de&gt;&gt;(seed: T) -&gt; Result&lt;T::Value, Error&gt;
# {
# let _ = seed;
# unimplemented!()
# }
</code></pre>
<p>In practice the majority of deserialization is stateless. An API expecting a
seed can be appeased by passing <code>std::marker::PhantomData</code> as a seed in the
case of stateless deserialization.</p>
<h1 id="lifetime" class="section-header"><a href="#lifetime">Lifetime</a></h1>
<p>The <code>'de</code> lifetime of this trait is the lifetime of data that may be
borrowed by <code>Self::Value</code> when deserialized. See the page <a href="https://serde.rs/lifetimes.html">Understanding
deserializer lifetimes</a> for a more detailed explanation of these lifetimes.</p>
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
<p>Suppose we have JSON that looks like <code>[[1, 2], [3, 4, 5], [6]]</code> and we need
to deserialize it into a flat representation like <code>vec![1, 2, 3, 4, 5, 6]</code>.
Allocating a brand new <code>Vec&lt;T&gt;</code> for each subarray would be slow. Instead we
would like to allocate a single <code>Vec&lt;T&gt;</code> and then deserialize each subarray
into it. This requires stateful deserialization using the <code>DeserializeSeed</code>
trait.</p>
<pre><code class="language-edition2018">use std::fmt;
use std::marker::PhantomData;
use serde::de::{Deserialize, DeserializeSeed, Deserializer, SeqAccess, Visitor};
// A DeserializeSeed implementation that uses stateful deserialization to
// append array elements onto the end of an existing vector. The preexisting
// state (&quot;seed&quot;) in this case is the Vec&lt;T&gt;. The `deserialize` method of
// `ExtendVec` will be traversing the inner arrays of the JSON input and
// appending each integer into the existing Vec.
struct ExtendVec&lt;'a, T: 'a&gt;(&amp;'a mut Vec&lt;T&gt;);
impl&lt;'de, 'a, T&gt; DeserializeSeed&lt;'de&gt; for ExtendVec&lt;'a, T&gt;
where
T: Deserialize&lt;'de&gt;,
{
// The return type of the `deserialize` method. This implementation
// appends onto an existing vector but does not create any new data
// structure, so the return type is ().
type Value = ();
fn deserialize&lt;D&gt;(self, deserializer: D) -&gt; Result&lt;Self::Value, D::Error&gt;
where
D: Deserializer&lt;'de&gt;,
{
// Visitor implementation that will walk an inner array of the JSON
// input.
struct ExtendVecVisitor&lt;'a, T: 'a&gt;(&amp;'a mut Vec&lt;T&gt;);
impl&lt;'de, 'a, T&gt; Visitor&lt;'de&gt; for ExtendVecVisitor&lt;'a, T&gt;
where
T: Deserialize&lt;'de&gt;,
{
type Value = ();
fn expecting(&amp;self, formatter: &amp;mut fmt::Formatter) -&gt; fmt::Result {
write!(formatter, &quot;an array of integers&quot;)
}
fn visit_seq&lt;A&gt;(self, mut seq: A) -&gt; Result&lt;(), A::Error&gt;
where
A: SeqAccess&lt;'de&gt;,
{
// Visit each element in the inner array and push it onto
// the existing vector.
while let Some(elem) = seq.next_element()? {
self.0.push(elem);
}
Ok(())
}
}
deserializer.deserialize_seq(ExtendVecVisitor(self.0))
}
}
// Visitor implementation that will walk the outer array of the JSON input.
struct FlattenedVecVisitor&lt;T&gt;(PhantomData&lt;T&gt;);
impl&lt;'de, T&gt; Visitor&lt;'de&gt; for FlattenedVecVisitor&lt;T&gt;
where
T: Deserialize&lt;'de&gt;,
{
// This Visitor constructs a single Vec&lt;T&gt; to hold the flattened
// contents of the inner arrays.
type Value = Vec&lt;T&gt;;
fn expecting(&amp;self, formatter: &amp;mut fmt::Formatter) -&gt; fmt::Result {
write!(formatter, &quot;an array of arrays&quot;)
}
fn visit_seq&lt;A&gt;(self, mut seq: A) -&gt; Result&lt;Vec&lt;T&gt;, A::Error&gt;
where
A: SeqAccess&lt;'de&gt;,
{
// Create a single Vec to hold the flattened contents.
let mut vec = Vec::new();
// Each iteration through this loop is one inner array.
while let Some(()) = seq.next_element_seed(ExtendVec(&amp;mut vec))? {
// Nothing to do; inner array has been appended into `vec`.
}
// Return the finished vec.
Ok(vec)
}
}
# fn example&lt;'de, D&gt;(deserializer: D) -&gt; Result&lt;(), D::Error&gt;
# where
# D: Deserializer&lt;'de&gt;,
# {
let visitor = FlattenedVecVisitor(PhantomData);
let flattened: Vec&lt;u64&gt; = deserializer.deserialize_seq(visitor)?;
# Ok(())
# }
</code></pre>
</div>
<h2 id='associated-types' class='small-section-header'>Associated Types<a href='#associated-types' class='anchor'></a></h2><div class='methods'><h3 id='associatedtype.Value' class='method'><code id='Value.t'>type <a href='#associatedtype.Value' class="type">Value</a></code></h3><div class='docblock'><p>The type produced by using this seed.</p>
</div></div><span class='loading-content'>Loading content...</span>
<h2 id='required-methods' class='small-section-header'>Required methods<a href='#required-methods' class='anchor'></a></h2><div class='methods'><h3 id='tymethod.deserialize' class='method'><code id='deserialize.v'>fn <a href='#tymethod.deserialize' class='fnname'>deserialize</a>&lt;D&gt;(self, deserializer: D) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="type" href="../../serde/de/trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>, D::<a class="type" href="../../serde/trait.Deserializer.html#associatedtype.Error" title="type serde::Deserializer::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;D: <a class="trait" href="../../serde/trait.Deserializer.html" title="trait serde::Deserializer">Deserializer</a>&lt;'de&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Equivalent to the more common <code>Deserialize::deserialize</code> method, except
with some initial piece of data (the seed) passed in.</p>
</div></div><span class='loading-content'>Loading content...</span>
<h2 id='foreign-impls' class='small-section-header'>Implementations on Foreign Types<a href='#foreign-impls' class='anchor'></a></h2><h3 id='impl-DeserializeSeed%3C%27de%3E-for-PhantomData%3CT%3E' class='impl'><code class='in-band'>impl&lt;'de, T&gt; <a class="trait" href="../../serde/de/trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt; for <a class="struct" href="https://doc.rust-lang.org/nightly/core/marker/struct.PhantomData.html" title="struct core::marker::PhantomData">PhantomData</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../serde/trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a>&lt;'de&gt;,&nbsp;</span></code><a href='#impl-DeserializeSeed%3C%27de%3E-for-PhantomData%3CT%3E' class='anchor'></a><a class='srclink' href='../../src/serde/de/mod.rs.html#768-781' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Value-1' class="type"><code id='Value.t-1'>type <a href='#associatedtype.Value' class="type">Value</a> = T</code></h4><h4 id='method.deserialize' class="method hidden"><code id='deserialize.v-1'>fn <a href='#method.deserialize' class='fnname'>deserialize</a>&lt;D&gt;(self, deserializer: D) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, D::<a class="type" href="../../serde/trait.Deserializer.html#associatedtype.Error" title="type serde::Deserializer::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;D: <a class="trait" href="../../serde/trait.Deserializer.html" title="trait serde::Deserializer">Deserializer</a>&lt;'de&gt;,&nbsp;</span></code><a class='srclink' href='../../src/serde/de/mod.rs.html#775-780' title='goto source code'>[src]</a></h4></div><span class='loading-content'>Loading content...</span>
<h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'></div><span class='loading-content'>Loading content...</span><script type="text/javascript">window.inlined_types=new Set([]);</script><script type="text/javascript" async
src="../../implementors/serde/de/trait.DeserializeSeed.js">
</script></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../../";window.currentCrate = "serde";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,92 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `Error` trait in crate `serde`."><meta name="keywords" content="rust, rustlang, rust-lang, Error"><title>serde::de::Error - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../serde/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><p class='location'>Trait Error</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.custom">custom</a></div><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.duplicate_field">duplicate_field</a><a href="#method.invalid_length">invalid_length</a><a href="#method.invalid_type">invalid_type</a><a href="#method.invalid_value">invalid_value</a><a href="#method.missing_field">missing_field</a><a href="#method.unknown_field">unknown_field</a><a href="#method.unknown_variant">unknown_variant</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='../index.html'>serde</a>::<wbr><a href='index.html'>de</a></p><script>window.sidebarCurrent = {name: 'Error', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/serde/de/mod.rs.html#152-286' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='../index.html'>serde</a>::<wbr><a href='index.html'>de</a>::<wbr><a class="trait" href=''>Error</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'>pub trait Error: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a> {
fn <a href='#tymethod.custom' class='fnname'>custom</a>&lt;T&gt;(msg: T) -&gt; Self<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a></span>;
fn <a href='#method.invalid_type' class='fnname'>invalid_type</a>(unexp: <a class="enum" href="../../serde/de/enum.Unexpected.html" title="enum serde::de::Unexpected">Unexpected</a>, exp: &amp;dyn <a class="trait" href="../../serde/de/trait.Expected.html" title="trait serde::de::Expected">Expected</a>) -&gt; Self { ... }
<div class='item-spacer'></div> fn <a href='#method.invalid_value' class='fnname'>invalid_value</a>(unexp: <a class="enum" href="../../serde/de/enum.Unexpected.html" title="enum serde::de::Unexpected">Unexpected</a>, exp: &amp;dyn <a class="trait" href="../../serde/de/trait.Expected.html" title="trait serde::de::Expected">Expected</a>) -&gt; Self { ... }
<div class='item-spacer'></div> fn <a href='#method.invalid_length' class='fnname'>invalid_length</a>(len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, exp: &amp;dyn <a class="trait" href="../../serde/de/trait.Expected.html" title="trait serde::de::Expected">Expected</a>) -&gt; Self { ... }
<div class='item-spacer'></div> fn <a href='#method.unknown_variant' class='fnname'>unknown_variant</a>(variant: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, expected: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'static [</a>&amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; Self { ... }
<div class='item-spacer'></div> fn <a href='#method.unknown_field' class='fnname'>unknown_field</a>(field: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, expected: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'static [</a>&amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; Self { ... }
<div class='item-spacer'></div> fn <a href='#method.missing_field' class='fnname'>missing_field</a>(field: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; Self { ... }
<div class='item-spacer'></div> fn <a href='#method.duplicate_field' class='fnname'>duplicate_field</a>(field: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; Self { ... }
}</pre></div><div class='docblock'><p>The <code>Error</code> trait allows <code>Deserialize</code> implementations to create descriptive
error messages belonging to the <code>Deserializer</code> against which they are
currently running.</p>
<p>Every <code>Deserializer</code> declares an <code>Error</code> type that encompasses both
general-purpose deserialization errors as well as errors specific to the
particular deserialization format. For example the <code>Error</code> type of
<code>serde_json</code> can represent errors like an invalid JSON escape sequence or an
unterminated string literal, in addition to the error cases that are part of
this trait.</p>
<p>Most deserializers should only need to provide the <code>Error::custom</code> method
and inherit the default behavior for the other methods.</p>
<h1 id="example-implementation" class="section-header"><a href="#example-implementation">Example implementation</a></h1>
<p>The <a href="https://serde.rs/data-format.html">example data format</a> presented on the website shows an error
type appropriate for a basic JSON data format.</p>
</div>
<h2 id='required-methods' class='small-section-header'>Required methods<a href='#required-methods' class='anchor'></a></h2><div class='methods'><h3 id='tymethod.custom' class='method'><code id='custom.v'>fn <a href='#tymethod.custom' class='fnname'>custom</a>&lt;T&gt;(msg: T) -&gt; Self <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>,&nbsp;</span></code></h3><div class='docblock'><p>Raised when there is general error when deserializing a type.</p>
<p>The message should not be capitalized and should not end with a period.</p>
<pre><code class="language-edition2018"># use std::str::FromStr;
#
# struct IpAddr;
#
# impl FromStr for IpAddr {
# type Err = String;
#
# fn from_str(_: &amp;str) -&gt; Result&lt;Self, String&gt; {
# unimplemented!()
# }
# }
#
use serde::de::{self, Deserialize, Deserializer};
impl&lt;'de&gt; Deserialize&lt;'de&gt; for IpAddr {
fn deserialize&lt;D&gt;(deserializer: D) -&gt; Result&lt;Self, D::Error&gt;
where
D: Deserializer&lt;'de&gt;,
{
let s = String::deserialize(deserializer)?;
s.parse().map_err(de::Error::custom)
}
}
</code></pre>
</div></div><span class='loading-content'>Loading content...</span>
<h2 id='provided-methods' class='small-section-header'>Provided methods<a href='#provided-methods' class='anchor'></a></h2><div class='methods'><h3 id='method.invalid_type' class='method'><code id='invalid_type.v'>fn <a href='#method.invalid_type' class='fnname'>invalid_type</a>(unexp: <a class="enum" href="../../serde/de/enum.Unexpected.html" title="enum serde::de::Unexpected">Unexpected</a>, exp: &amp;dyn <a class="trait" href="../../serde/de/trait.Expected.html" title="trait serde::de::Expected">Expected</a>) -&gt; Self</code></h3><div class='docblock'><p>Raised when a <code>Deserialize</code> receives a type different from what it was
expecting.</p>
<p>The <code>unexp</code> argument provides information about what type was received.
This is the type that was present in the input file or other source data
of the Deserializer.</p>
<p>The <code>exp</code> argument provides information about what type was being
expected. This is the type that is written in the program.</p>
<p>For example if we try to deserialize a String out of a JSON file
containing an integer, the unexpected type is the integer and the
expected type is the string.</p>
</div><h3 id='method.invalid_value' class='method'><code id='invalid_value.v'>fn <a href='#method.invalid_value' class='fnname'>invalid_value</a>(unexp: <a class="enum" href="../../serde/de/enum.Unexpected.html" title="enum serde::de::Unexpected">Unexpected</a>, exp: &amp;dyn <a class="trait" href="../../serde/de/trait.Expected.html" title="trait serde::de::Expected">Expected</a>) -&gt; Self</code></h3><div class='docblock'><p>Raised when a <code>Deserialize</code> receives a value of the right type but that
is wrong for some other reason.</p>
<p>The <code>unexp</code> argument provides information about what value was received.
This is the value that was present in the input file or other source
data of the Deserializer.</p>
<p>The <code>exp</code> argument provides information about what value was being
expected. This is the type that is written in the program.</p>
<p>For example if we try to deserialize a String out of some binary data
that is not valid UTF-8, the unexpected value is the bytes and the
expected value is a string.</p>
</div><h3 id='method.invalid_length' class='method'><code id='invalid_length.v'>fn <a href='#method.invalid_length' class='fnname'>invalid_length</a>(len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, exp: &amp;dyn <a class="trait" href="../../serde/de/trait.Expected.html" title="trait serde::de::Expected">Expected</a>) -&gt; Self</code></h3><div class='docblock'><p>Raised when deserializing a sequence or map and the input data contains
too many or too few elements.</p>
<p>The <code>len</code> argument is the number of elements encountered. The sequence
or map may have expected more arguments or fewer arguments.</p>
<p>The <code>exp</code> argument provides information about what data was being
expected. For example <code>exp</code> might say that a tuple of size 6 was
expected.</p>
</div><h3 id='method.unknown_variant' class='method'><code id='unknown_variant.v'>fn <a href='#method.unknown_variant' class='fnname'>unknown_variant</a>(variant: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, expected: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'static [</a>&amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; Self</code></h3><div class='docblock'><p>Raised when a <code>Deserialize</code> enum type received a variant with an
unrecognized name.</p>
</div><h3 id='method.unknown_field' class='method'><code id='unknown_field.v'>fn <a href='#method.unknown_field' class='fnname'>unknown_field</a>(field: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, expected: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'static [</a>&amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; Self</code></h3><div class='docblock'><p>Raised when a <code>Deserialize</code> struct type received a field with an
unrecognized name.</p>
</div><h3 id='method.missing_field' class='method'><code id='missing_field.v'>fn <a href='#method.missing_field' class='fnname'>missing_field</a>(field: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; Self</code></h3><div class='docblock'><p>Raised when a <code>Deserialize</code> struct type expected to receive a required
field with a particular name but that field was not present in the
input.</p>
</div><h3 id='method.duplicate_field' class='method'><code id='duplicate_field.v'>fn <a href='#method.duplicate_field' class='fnname'>duplicate_field</a>(field: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; Self</code></h3><div class='docblock'><p>Raised when a <code>Deserialize</code> struct type received more than one of the
same field.</p>
</div></div><span class='loading-content'>Loading content...</span>
<h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'><h3 id='impl-Error' class='impl'><code class='in-band'>impl Error for <a class="struct" href="../../serde/de/value/struct.Error.html" title="struct serde::de::value::Error">Error</a></code><a href='#impl-Error' class='anchor'></a><a class='srclink' href='../../src/serde/de/value.rs.html#61-82' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.custom' class="method hidden"><code id='custom.v-1'>fn <a href='#method.custom' class='fnname'>custom</a>&lt;T&gt;(msg: T) -&gt; Self <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>,&nbsp;</span></code><a class='srclink' href='../../src/serde/de/value.rs.html#64-71' title='goto source code'>[src]</a></h4></div></div><span class='loading-content'>Loading content...</span><script type="text/javascript">window.inlined_types=new Set([]);</script><script type="text/javascript" async
src="../../implementors/serde/de/trait.Error.js">
</script></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../../";window.currentCrate = "serde";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>

View File

@@ -0,0 +1,53 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `Expected` trait in crate `serde`."><meta name="keywords" content="rust, rustlang, rust-lang, Expected"><title>serde::de::Expected - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../serde/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><p class='location'>Trait Expected</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.fmt">fmt</a></div><a class="sidebar-title" href="#foreign-impls">Implementations on Foreign Types</a><div class="sidebar-links"><a href="#impl-Expected-for-%26%27a%20str">&amp;&#39;a str</a></div><a class="sidebar-title" href="#implementors">Implementors</a><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Display">Display</a></div></div><p class='location'><a href='../index.html'>serde</a>::<wbr><a href='index.html'>de</a></p><script>window.sidebarCurrent = {name: 'Expected', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/serde/de/mod.rs.html#463-467' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='../index.html'>serde</a>::<wbr><a href='index.html'>de</a>::<wbr><a class="trait" href=''>Expected</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'>pub trait Expected {
fn <a href='#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, formatter: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a>;
}</pre></div><div class='docblock'><p><code>Expected</code> represents an explanation of what data a <code>Visitor</code> was expecting
to receive.</p>
<p>This is used as an argument to the <code>invalid_type</code>, <code>invalid_value</code>, and
<code>invalid_length</code> methods of the <code>Error</code> trait to build error messages. The
message should be a noun or noun phrase that completes the sentence &quot;This
Visitor expects to receive ...&quot;, for example the message could be &quot;an
integer between 0 and 64&quot;. The message should not be capitalized and should
not end with a period.</p>
<p>Within the context of a <code>Visitor</code> implementation, the <code>Visitor</code> itself
(<code>&amp;self</code>) is an implementation of this trait.</p>
<pre><code class="language-edition2018"># use std::fmt;
#
# use serde::de::{self, Unexpected, Visitor};
#
# struct Example;
#
# impl&lt;'de&gt; Visitor&lt;'de&gt; for Example {
# type Value = ();
#
# fn expecting(&amp;self, formatter: &amp;mut fmt::Formatter) -&gt; fmt::Result {
# write!(formatter, &quot;definitely not a boolean&quot;)
# }
#
fn visit_bool&lt;E&gt;(self, v: bool) -&gt; Result&lt;Self::Value, E&gt;
where
E: de::Error,
{
Err(de::Error::invalid_type(Unexpected::Bool(v), &amp;self))
}
# }
</code></pre>
<p>Outside of a <code>Visitor</code>, <code>&amp;&quot;...&quot;</code> can be used.</p>
<pre><code class="language-edition2018"># use serde::de::{self, Unexpected};
#
# fn example&lt;E&gt;() -&gt; Result&lt;(), E&gt;
# where
# E: de::Error,
# {
# let v = true;
return Err(de::Error::invalid_type(Unexpected::Bool(v), &amp;&quot;a negative integer&quot;));
# }
</code></pre>
</div>
<h2 id='required-methods' class='small-section-header'>Required methods<a href='#required-methods' class='anchor'></a></h2><div class='methods'><h3 id='tymethod.fmt' class='method'><code id='fmt.v'>fn <a href='#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, formatter: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></h3><div class='docblock'><p>Format an explanation of what data was being expected. Same signature as
the <code>Display</code> and <code>Debug</code> traits.</p>
</div></div><span class='loading-content'>Loading content...</span><h2 id='implementations' class='small-section-header'>Trait Implementations<a href='#implementations' class='anchor'></a></h2><div id='implementations-list'><h3 id='impl-Display' class='impl'><code class='in-band'>impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for dyn <a class="trait" href="../../serde/de/trait.Expected.html" title="trait serde::de::Expected">Expected</a> + 'a</code><a href='#impl-Display' class='anchor'></a><a class='srclink' href='../../src/serde/de/mod.rs.html#484-488' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.fmt' class="method hidden"><code id='fmt.v-1'>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, formatter: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class='srclink' href='../../src/serde/de/mod.rs.html#485-487' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></p>
</div></div></div>
<h2 id='foreign-impls' class='small-section-header'>Implementations on Foreign Types<a href='#foreign-impls' class='anchor'></a></h2><h3 id='impl-Expected-for-%26%27a%20str' class='impl'><code class='in-band'>impl&lt;'a&gt; <a class="trait" href="../../serde/de/trait.Expected.html" title="trait serde::de::Expected">Expected</a> for &amp;'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code><a href='#impl-Expected-for-%26%27a%20str' class='anchor'></a><a class='srclink' href='../../src/serde/de/mod.rs.html#478-482' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.fmt-1' class="method hidden"><code id='fmt.v-2'>fn <a href='#method.fmt' class='fnname'>fmt</a>(&amp;self, formatter: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class='srclink' href='../../src/serde/de/mod.rs.html#479-481' title='goto source code'>[src]</a></h4></div><span class='loading-content'>Loading content...</span>
<h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'><h3 id='impl-Expected' class='impl'><code class='in-band'>impl&lt;'de, T&gt; Expected for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../serde/de/trait.Visitor.html" title="trait serde::de::Visitor">Visitor</a>&lt;'de&gt;,&nbsp;</span></code><a href='#impl-Expected' class='anchor'></a><a class='srclink' href='../../src/serde/de/mod.rs.html#469-476' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.fmt-2' class="method hidden"><code id='fmt.v-3'>fn <a href='#method.fmt-2' class='fnname'>fmt</a>(&amp;self, formatter: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class='srclink' href='../../src/serde/de/mod.rs.html#473-475' title='goto source code'>[src]</a></h4></div></div><span class='loading-content'>Loading content...</span><script type="text/javascript">window.inlined_types=new Set([]);</script><script type="text/javascript" async
src="../../implementors/serde/de/trait.Expected.js">
</script></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../../";window.currentCrate = "serde";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,178 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `VariantAccess` trait in crate `serde`."><meta name="keywords" content="rust, rustlang, rust-lang, VariantAccess"><title>serde::de::VariantAccess - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../serde/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><p class='location'>Trait VariantAccess</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#associated-types">Associated Types</a><div class="sidebar-links"><a href="#associatedtype.Error">Error</a></div><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.newtype_variant_seed">newtype_variant_seed</a><a href="#tymethod.struct_variant">struct_variant</a><a href="#tymethod.tuple_variant">tuple_variant</a><a href="#tymethod.unit_variant">unit_variant</a></div><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.newtype_variant">newtype_variant</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='../index.html'>serde</a>::<wbr><a href='index.html'>de</a></p><script>window.sidebarCurrent = {name: 'VariantAccess', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/serde/de/mod.rs.html#1998-2194' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='../index.html'>serde</a>::<wbr><a href='index.html'>de</a>::<wbr><a class="trait" href=''>VariantAccess</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'>pub trait VariantAccess&lt;'de&gt;: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
type <a href='#associatedtype.Error' class="type">Error</a>: <a class="trait" href="../../serde/de/trait.Error.html" title="trait serde::de::Error">Error</a>;
fn <a href='#tymethod.unit_variant' class='fnname'>unit_variant</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../../serde/de/trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.newtype_variant_seed' class='fnname'>newtype_variant_seed</a>&lt;T&gt;(self, seed: T) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T::<a class="type" href="../../serde/de/trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>, Self::<a class="type" href="../../serde/de/trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../serde/de/trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.tuple_variant' class='fnname'>tuple_variant</a>&lt;V&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;visitor: V<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;V::<a class="type" href="../../serde/de/trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, Self::<a class="type" href="../../serde/de/trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;V: <a class="trait" href="../../serde/de/trait.Visitor.html" title="trait serde::de::Visitor">Visitor</a>&lt;'de&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.struct_variant' class='fnname'>struct_variant</a>&lt;V&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fields: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'static [</a>&amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;visitor: V<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;V::<a class="type" href="../../serde/de/trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, Self::<a class="type" href="../../serde/de/trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;V: <a class="trait" href="../../serde/de/trait.Visitor.html" title="trait serde::de::Visitor">Visitor</a>&lt;'de&gt;</span>;
fn <a href='#method.newtype_variant' class='fnname'>newtype_variant</a>&lt;T&gt;(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, Self::<a class="type" href="../../serde/de/trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../serde/trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a>&lt;'de&gt;</span>,
{ ... }
}</pre></div><div class='docblock'><p><code>VariantAccess</code> is a visitor that is created by the <code>Deserializer</code> and
passed to the <code>Deserialize</code> to deserialize the content of a particular enum
variant.</p>
<h1 id="lifetime" class="section-header"><a href="#lifetime">Lifetime</a></h1>
<p>The <code>'de</code> lifetime of this trait is the lifetime of data that may be
borrowed by the deserialized enum variant. See the page <a href="https://serde.rs/lifetimes.html">Understanding
deserializer lifetimes</a> for a more detailed explanation of these lifetimes.</p>
<h1 id="example-implementation" class="section-header"><a href="#example-implementation">Example implementation</a></h1>
<p>The <a href="https://serde.rs/data-format.html">example data format</a> presented on the website demonstrates an
implementation of <code>VariantAccess</code> for a basic JSON data format.</p>
</div>
<h2 id='associated-types' class='small-section-header'>Associated Types<a href='#associated-types' class='anchor'></a></h2><div class='methods'><h3 id='associatedtype.Error' class='method'><code id='Error.t'>type <a href='#associatedtype.Error' class="type">Error</a>: <a class="trait" href="../../serde/de/trait.Error.html" title="trait serde::de::Error">Error</a></code></h3><div class='docblock'><p>The error type that can be returned if some error occurs during
deserialization. Must match the error type of our <code>EnumAccess</code>.</p>
</div></div><span class='loading-content'>Loading content...</span>
<h2 id='required-methods' class='small-section-header'>Required methods<a href='#required-methods' class='anchor'></a></h2><div class='methods'><h3 id='tymethod.unit_variant' class='method'><code id='unit_variant.v'>fn <a href='#tymethod.unit_variant' class='fnname'>unit_variant</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../../serde/de/trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>&gt;</code></h3><div class='docblock'><p>Called when deserializing a variant with no values.</p>
<p>If the data contains a different type of variant, the following
<code>invalid_type</code> error should be constructed:</p>
<pre><code class="language-edition2018"># use serde::de::{self, value, DeserializeSeed, Visitor, VariantAccess, Unexpected};
#
# struct X;
#
# impl&lt;'de&gt; VariantAccess&lt;'de&gt; for X {
# type Error = value::Error;
#
fn unit_variant(self) -&gt; Result&lt;(), Self::Error&gt; {
// What the data actually contained; suppose it is a tuple variant.
let unexp = Unexpected::TupleVariant;
Err(de::Error::invalid_type(unexp, &amp;&quot;unit variant&quot;))
}
#
# fn newtype_variant_seed&lt;T&gt;(self, _: T) -&gt; Result&lt;T::Value, Self::Error&gt;
# where
# T: DeserializeSeed&lt;'de&gt;,
# { unimplemented!() }
#
# fn tuple_variant&lt;V&gt;(self, _: usize, _: V) -&gt; Result&lt;V::Value, Self::Error&gt;
# where
# V: Visitor&lt;'de&gt;,
# { unimplemented!() }
#
# fn struct_variant&lt;V&gt;(self, _: &amp;[&amp;str], _: V) -&gt; Result&lt;V::Value, Self::Error&gt;
# where
# V: Visitor&lt;'de&gt;,
# { unimplemented!() }
# }
</code></pre>
</div><h3 id='tymethod.newtype_variant_seed' class='method'><code id='newtype_variant_seed.v'>fn <a href='#tymethod.newtype_variant_seed' class='fnname'>newtype_variant_seed</a>&lt;T&gt;(self, seed: T) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T::<a class="type" href="../../serde/de/trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>, Self::<a class="type" href="../../serde/de/trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../serde/de/trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Called when deserializing a variant with a single value.</p>
<p><code>Deserialize</code> implementations should typically use
<code>VariantAccess::newtype_variant</code> instead.</p>
<p>If the data contains a different type of variant, the following
<code>invalid_type</code> error should be constructed:</p>
<pre><code class="language-edition2018"># use serde::de::{self, value, DeserializeSeed, Visitor, VariantAccess, Unexpected};
#
# struct X;
#
# impl&lt;'de&gt; VariantAccess&lt;'de&gt; for X {
# type Error = value::Error;
#
# fn unit_variant(self) -&gt; Result&lt;(), Self::Error&gt; {
# unimplemented!()
# }
#
fn newtype_variant_seed&lt;T&gt;(self, _seed: T) -&gt; Result&lt;T::Value, Self::Error&gt;
where
T: DeserializeSeed&lt;'de&gt;,
{
// What the data actually contained; suppose it is a unit variant.
let unexp = Unexpected::UnitVariant;
Err(de::Error::invalid_type(unexp, &amp;&quot;newtype variant&quot;))
}
#
# fn tuple_variant&lt;V&gt;(self, _: usize, _: V) -&gt; Result&lt;V::Value, Self::Error&gt;
# where
# V: Visitor&lt;'de&gt;,
# { unimplemented!() }
#
# fn struct_variant&lt;V&gt;(self, _: &amp;[&amp;str], _: V) -&gt; Result&lt;V::Value, Self::Error&gt;
# where
# V: Visitor&lt;'de&gt;,
# { unimplemented!() }
# }
</code></pre>
</div><h3 id='tymethod.tuple_variant' class='method'><code id='tuple_variant.v'>fn <a href='#tymethod.tuple_variant' class='fnname'>tuple_variant</a>&lt;V&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;visitor: V<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;V::<a class="type" href="../../serde/de/trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, Self::<a class="type" href="../../serde/de/trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;V: <a class="trait" href="../../serde/de/trait.Visitor.html" title="trait serde::de::Visitor">Visitor</a>&lt;'de&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Called when deserializing a tuple-like variant.</p>
<p>The <code>len</code> is the number of fields expected in the tuple variant.</p>
<p>If the data contains a different type of variant, the following
<code>invalid_type</code> error should be constructed:</p>
<pre><code class="language-edition2018"># use serde::de::{self, value, DeserializeSeed, Visitor, VariantAccess, Unexpected};
#
# struct X;
#
# impl&lt;'de&gt; VariantAccess&lt;'de&gt; for X {
# type Error = value::Error;
#
# fn unit_variant(self) -&gt; Result&lt;(), Self::Error&gt; {
# unimplemented!()
# }
#
# fn newtype_variant_seed&lt;T&gt;(self, _: T) -&gt; Result&lt;T::Value, Self::Error&gt;
# where
# T: DeserializeSeed&lt;'de&gt;,
# { unimplemented!() }
#
fn tuple_variant&lt;V&gt;(
self,
_len: usize,
_visitor: V,
) -&gt; Result&lt;V::Value, Self::Error&gt;
where
V: Visitor&lt;'de&gt;,
{
// What the data actually contained; suppose it is a unit variant.
let unexp = Unexpected::UnitVariant;
Err(de::Error::invalid_type(unexp, &amp;&quot;tuple variant&quot;))
}
#
# fn struct_variant&lt;V&gt;(self, _: &amp;[&amp;str], _: V) -&gt; Result&lt;V::Value, Self::Error&gt;
# where
# V: Visitor&lt;'de&gt;,
# { unimplemented!() }
# }
</code></pre>
</div><h3 id='tymethod.struct_variant' class='method'><code id='struct_variant.v'>fn <a href='#tymethod.struct_variant' class='fnname'>struct_variant</a>&lt;V&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;fields: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'static [</a>&amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;visitor: V<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;V::<a class="type" href="../../serde/de/trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, Self::<a class="type" href="../../serde/de/trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;V: <a class="trait" href="../../serde/de/trait.Visitor.html" title="trait serde::de::Visitor">Visitor</a>&lt;'de&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Called when deserializing a struct-like variant.</p>
<p>The <code>fields</code> are the names of the fields of the struct variant.</p>
<p>If the data contains a different type of variant, the following
<code>invalid_type</code> error should be constructed:</p>
<pre><code class="language-edition2018"># use serde::de::{self, value, DeserializeSeed, Visitor, VariantAccess, Unexpected};
#
# struct X;
#
# impl&lt;'de&gt; VariantAccess&lt;'de&gt; for X {
# type Error = value::Error;
#
# fn unit_variant(self) -&gt; Result&lt;(), Self::Error&gt; {
# unimplemented!()
# }
#
# fn newtype_variant_seed&lt;T&gt;(self, _: T) -&gt; Result&lt;T::Value, Self::Error&gt;
# where
# T: DeserializeSeed&lt;'de&gt;,
# { unimplemented!() }
#
# fn tuple_variant&lt;V&gt;(self, _: usize, _: V) -&gt; Result&lt;V::Value, Self::Error&gt;
# where
# V: Visitor&lt;'de&gt;,
# { unimplemented!() }
#
fn struct_variant&lt;V&gt;(
self,
_fields: &amp;'static [&amp;'static str],
_visitor: V,
) -&gt; Result&lt;V::Value, Self::Error&gt;
where
V: Visitor&lt;'de&gt;,
{
// What the data actually contained; suppose it is a unit variant.
let unexp = Unexpected::UnitVariant;
Err(de::Error::invalid_type(unexp, &amp;&quot;struct variant&quot;))
}
# }
</code></pre>
</div></div><span class='loading-content'>Loading content...</span>
<h2 id='provided-methods' class='small-section-header'>Provided methods<a href='#provided-methods' class='anchor'></a></h2><div class='methods'><h3 id='method.newtype_variant' class='method'><code id='newtype_variant.v'>fn <a href='#method.newtype_variant' class='fnname'>newtype_variant</a>&lt;T&gt;(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, Self::<a class="type" href="../../serde/de/trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../serde/trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a>&lt;'de&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Called when deserializing a variant with a single value.</p>
<p>This method exists as a convenience for <code>Deserialize</code> implementations.
<code>VariantAccess</code> implementations should not override the default
behavior.</p>
</div></div><span class='loading-content'>Loading content...</span>
<h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'></div><span class='loading-content'>Loading content...</span><script type="text/javascript">window.inlined_types=new Set([]);</script><script type="text/javascript" async
src="../../implementors/serde/de/trait.VariantAccess.js">
</script></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../../";window.currentCrate = "serde";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,67 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `value` mod in crate `serde`."><meta name="keywords" content="rust, rustlang, rust-lang, value"><title>serde::de::value - Rust</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../../serde/index.html'><div class='logo-container'><img src='../../../rust-logo.png' alt='logo'></div></a><p class='location'>Module value</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li></ul></div><p class='location'><a href='../../index.html'>serde</a>::<wbr><a href='../index.html'>de</a></p><script>window.sidebarCurrent = {name: 'value', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../../src/serde/de/value.rs.html#1-1497' title='goto source code'>[src]</a></span><span class='in-band'>Module <a href='../../index.html'>serde</a>::<wbr><a href='../index.html'>de</a>::<wbr><a class="mod" href=''>value</a></span></h1><div class='docblock'><p>Building blocks for deserializing basic values using the <code>IntoDeserializer</code>
trait.</p>
<pre><code class="language-edition2018">use std::str::FromStr;
use serde::Deserialize;
use serde::de::{value, IntoDeserializer};
#[derive(Deserialize)]
enum Setting {
On,
Off,
}
impl FromStr for Setting {
type Err = value::Error;
fn from_str(s: &amp;str) -&gt; Result&lt;Self, Self::Err&gt; {
Self::deserialize(s.into_deserializer())
}
}
</code></pre>
</div><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table><tr class='module-item'><td><a class="struct" href="struct.BoolDeserializer.html" title='serde::de::value::BoolDeserializer struct'>BoolDeserializer</a></td><td class='docblock-short'><p>A deserializer holding
a <code>bool</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.BorrowedBytesDeserializer.html" title='serde::de::value::BorrowedBytesDeserializer struct'>BorrowedBytesDeserializer</a></td><td class='docblock-short'><p>A deserializer holding a <code>&amp;[u8]</code> with a lifetime tied to another
deserializer.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.BorrowedStrDeserializer.html" title='serde::de::value::BorrowedStrDeserializer struct'>BorrowedStrDeserializer</a></td><td class='docblock-short'><p>A deserializer holding a <code>&amp;str</code> with a lifetime tied to another
deserializer.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.CharDeserializer.html" title='serde::de::value::CharDeserializer struct'>CharDeserializer</a></td><td class='docblock-short'><p>A deserializer holding
a <code>char</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.CowStrDeserializer.html" title='serde::de::value::CowStrDeserializer struct'>CowStrDeserializer</a></td><td class='docblock-short'><p>A deserializer holding a <code>Cow&lt;str&gt;</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Error.html" title='serde::de::value::Error struct'>Error</a></td><td class='docblock-short'><p>A minimal representation of all possible errors that can occur using the
<code>IntoDeserializer</code> trait.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.F32Deserializer.html" title='serde::de::value::F32Deserializer struct'>F32Deserializer</a></td><td class='docblock-short'><p>A deserializer holding
an <code>f32</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.F64Deserializer.html" title='serde::de::value::F64Deserializer struct'>F64Deserializer</a></td><td class='docblock-short'><p>A deserializer holding
an <code>f64</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.I8Deserializer.html" title='serde::de::value::I8Deserializer struct'>I8Deserializer</a></td><td class='docblock-short'><p>A deserializer holding
an <code>i8</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.I16Deserializer.html" title='serde::de::value::I16Deserializer struct'>I16Deserializer</a></td><td class='docblock-short'><p>A deserializer holding
an <code>i16</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.I32Deserializer.html" title='serde::de::value::I32Deserializer struct'>I32Deserializer</a></td><td class='docblock-short'><p>A deserializer holding
an <code>i32</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.I64Deserializer.html" title='serde::de::value::I64Deserializer struct'>I64Deserializer</a></td><td class='docblock-short'><p>A deserializer holding
an <code>i64</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.I128Deserializer.html" title='serde::de::value::I128Deserializer struct'>I128Deserializer</a></td><td class='docblock-short'><p>A deserializer holding
an <code>i128</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.IsizeDeserializer.html" title='serde::de::value::IsizeDeserializer struct'>IsizeDeserializer</a></td><td class='docblock-short'><p>A deserializer holding
an <code>isize</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.MapAccessDeserializer.html" title='serde::de::value::MapAccessDeserializer struct'>MapAccessDeserializer</a></td><td class='docblock-short'><p>A deserializer holding a <code>MapAccess</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.MapDeserializer.html" title='serde::de::value::MapDeserializer struct'>MapDeserializer</a></td><td class='docblock-short'><p>A deserializer that iterates over a map.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.SeqAccessDeserializer.html" title='serde::de::value::SeqAccessDeserializer struct'>SeqAccessDeserializer</a></td><td class='docblock-short'><p>A deserializer holding a <code>SeqAccess</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.SeqDeserializer.html" title='serde::de::value::SeqDeserializer struct'>SeqDeserializer</a></td><td class='docblock-short'><p>A deserializer that iterates over a sequence.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.StrDeserializer.html" title='serde::de::value::StrDeserializer struct'>StrDeserializer</a></td><td class='docblock-short'><p>A deserializer holding a <code>&amp;str</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.StringDeserializer.html" title='serde::de::value::StringDeserializer struct'>StringDeserializer</a></td><td class='docblock-short'><p>A deserializer holding a <code>String</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.U8Deserializer.html" title='serde::de::value::U8Deserializer struct'>U8Deserializer</a></td><td class='docblock-short'><p>A deserializer holding
a <code>u8</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.U16Deserializer.html" title='serde::de::value::U16Deserializer struct'>U16Deserializer</a></td><td class='docblock-short'><p>A deserializer holding
a <code>u16</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.U32Deserializer.html" title='serde::de::value::U32Deserializer struct'>U32Deserializer</a></td><td class='docblock-short'><p>A deserializer holding a <code>u32</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.U64Deserializer.html" title='serde::de::value::U64Deserializer struct'>U64Deserializer</a></td><td class='docblock-short'><p>A deserializer holding
a <code>u64</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.U128Deserializer.html" title='serde::de::value::U128Deserializer struct'>U128Deserializer</a></td><td class='docblock-short'><p>A deserializer holding
a <code>u128</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.UnitDeserializer.html" title='serde::de::value::UnitDeserializer struct'>UnitDeserializer</a></td><td class='docblock-short'><p>A deserializer holding a <code>()</code>.</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.UsizeDeserializer.html" title='serde::de::value::UsizeDeserializer struct'>UsizeDeserializer</a></td><td class='docblock-short'><p>A deserializer holding
a <code>usize</code>.</p>
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../../../";window.currentCrate = "serde";</script><script src="../../../aliases.js"></script><script src="../../../main.js"></script><script defer src="../../../search-index.js"></script></body></html>

View File

@@ -0,0 +1 @@
initSidebarItems({"struct":[["BoolDeserializer","A deserializer holding a `bool`."],["BorrowedBytesDeserializer","A deserializer holding a `&[u8]` with a lifetime tied to another deserializer."],["BorrowedStrDeserializer","A deserializer holding a `&str` with a lifetime tied to another deserializer."],["CharDeserializer","A deserializer holding a `char`."],["CowStrDeserializer","A deserializer holding a `Cow<str>`."],["Error","A minimal representation of all possible errors that can occur using the `IntoDeserializer` trait."],["F32Deserializer","A deserializer holding an `f32`."],["F64Deserializer","A deserializer holding an `f64`."],["I128Deserializer","A deserializer holding an `i128`."],["I16Deserializer","A deserializer holding an `i16`."],["I32Deserializer","A deserializer holding an `i32`."],["I64Deserializer","A deserializer holding an `i64`."],["I8Deserializer","A deserializer holding an `i8`."],["IsizeDeserializer","A deserializer holding an `isize`."],["MapAccessDeserializer","A deserializer holding a `MapAccess`."],["MapDeserializer","A deserializer that iterates over a map."],["SeqAccessDeserializer","A deserializer holding a `SeqAccess`."],["SeqDeserializer","A deserializer that iterates over a sequence."],["StrDeserializer","A deserializer holding a `&str`."],["StringDeserializer","A deserializer holding a `String`."],["U128Deserializer","A deserializer holding a `u128`."],["U16Deserializer","A deserializer holding a `u16`."],["U32Deserializer","A deserializer holding a `u32`."],["U64Deserializer","A deserializer holding a `u64`."],["U8Deserializer","A deserializer holding a `u8`."],["UnitDeserializer","A deserializer holding a `()`."],["UsizeDeserializer","A deserializer holding a `usize`."]]});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long