You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Trac3r-rust/doc/serde/trait.Deserialize.html

31 lines
272 KiB

5 years ago
<!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 `Deserialize` trait in crate `serde`."><meta name="keywords" content="rust, rustlang, rust-lang, Deserialize"><title>serde::Deserialize - 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 Deserialize</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.deserialize">deserialize</a></div><a class="sidebar-title" href="#foreign-impls">Implementations on Foreign Types</a><div class="sidebar-links"><a href="#impl-Deserialize%3C%27de%3E-for-%26%27a%20%5Bu8%5D">&amp;&#39;a [u8]</a><a href="#impl-Deserialize%3C%27de%3E-for-%26%27a%20Path">&amp;&#39;a Path</a><a href="#impl-Deserialize%3C%27de%3E-for-%26%27a%20str">&amp;&#39;a str</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%200%5D">[T; 0]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%201%5D">[T; 1]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2010%5D">[T; 10]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2011%5D">[T; 11]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2012%5D">[T; 12]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2013%5D">[T; 13]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2014%5D">[T; 14]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2015%5D">[T; 15]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2016%5D">[T; 16]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2017%5D">[T; 17]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2018%5D">[T; 18]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2019%5D">[T; 19]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%202%5D">[T; 2]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2020%5D">[T; 20]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2021%5D">[T; 21]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2022%5D">[T; 22]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2023%5D">[T; 23]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2024%5D">[T; 24]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2025%5D">[T; 25]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2026%5D">[T; 26]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2027%5D">[T; 27]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2028%5D">[T; 28]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2029%5D">[T; 29]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%203%5D">[T; 3]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2030%5D">[T; 30]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2031%5D">[T; 31]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%2032%5D">[T; 32]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%204%5D">[T; 4]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%205%5D">[T; 5]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%206%5D">[T; 6]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%207%5D">[T; 7]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B%208%5D">[T; 8]</a><a href="#impl-Deserialize%3C%27de%3E-for-%5BT%3B
fn <a href='#tymethod.deserialize' class='fnname'>deserialize</a>&lt;D&gt;(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, 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>A <strong>data structure</strong> that can be deserialized from any data format supported
by Serde.</p>
<p>Serde provides <code>Deserialize</code> implementations for many Rust primitive and
standard library types. The complete list is <a href="https://docs.serde.rs/serde/de/index.html">here</a>. All of these can
be deserialized using Serde out of the box.</p>
<p>Additionally, Serde provides a procedural macro called <code>serde_derive</code> to
automatically generate <code>Deserialize</code> 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 <code>Deserialize</code> 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 <code>Deserialize</code> implementations for types that
they expose. For example the <code>linked-hash-map</code> crate provides a
<code>LinkedHashMap&lt;K, V&gt;</code> type that is deserializable by Serde because the crate
provides an implementation of <code>Deserialize</code> for it.</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</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>
</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.deserialize' class='method'><code id='deserialize.v'>fn <a href='#tymethod.deserialize' class='fnname'>deserialize</a>&lt;D&gt;(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, 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>Deserialize this value from the given Serde deserializer.</p>
<p>See the <a href="https://serde.rs/impl-deserialize.html">Implementing <code>Deserialize</code></a> section of the
manual for more information about how to implement this method.</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-Deserialize%3C%27de%3E-for-()' class='impl'><code class='in-band'>impl&lt;'de&gt; <a class="trait" href="../serde/trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a>&lt;'de&gt; for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a></code><a href='#impl-Deserialize%3C%27de%3E-for-()' class='anchor'></a><a class='srclink' href='../src/serde/de/impls.rs.html#35-42' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.deserialize' class="method hidden"><code id='deserialize.v-1'>fn <a href='#method.deserialize' class='fnname'>deserialize</a>&lt;D&gt;(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, 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/impls.rs.html#36-41' title='goto source code'>[src]</a></h4></div><h3 id='impl-Deserialize%3C%27de%3E-for-bool' class='impl'><code class='in-band'>impl&lt;'de&gt; <a class="trait" href="../serde/trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a>&lt;'de&gt; for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a href='#impl-Deserialize%3C%27de%3E-for-bool' class='anchor'></a><a class='srclink' href='../src/serde/de/impls.rs.html#73-80' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.deserialize-1' class="method hidden"><code id='deserialize.v-2'>fn <a href='#method.deserialize' class='fnname'>deserialize</a>&lt;D&gt;(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, 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/impls.rs.html#74-79' title='goto source code'>[src]</a></h4></div><h3 id='impl-Deserialize%3C%27de%3E-for-i8' class='impl'><code class='in-band'>impl&lt;'de&gt; <a class="trait" href="../serde/trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a>&lt;'de&gt; for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a></code><a href='#impl-Deserialize%3C%27de%3E-for-i8' class='anchor'></a><a class='srclink' href='../src/serde/de/impls.rs.html#113-135' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.deserialize-2' class="method hidden"><code id='deserialize.v-3'>fn <a href='#method.deserialize' class='fnname'>deserialize</a>&lt;D&gt;(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, 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/impls.rs.html#115-134' title='goto source code'>[src]</a></h4></div><h3 id='impl-Deserialize%3C%27de%3E-for-i16' class='impl'><code class='in-band'>impl&lt;'de&gt; <a class="trait" href="../serde/trait.Deseriali
<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-Deserialize%3C%27de%3E' class='impl'><code class='in-band'>impl&lt;'de&gt; Deserialize&lt;'de&gt; for <a class="struct" href="../serde/de/struct.IgnoredAny.html" title="struct serde::de::IgnoredAny">IgnoredAny</a></code><a href='#impl-Deserialize%3C%27de%3E' class='anchor'></a><a class='srclink' href='../src/serde/de/ignored_any.rs.html#219-227' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.deserialize-123' class="method hidden"><code id='deserialize.v-124'>fn <a href='#method.deserialize-123' class='fnname'>deserialize</a>&lt;D&gt;(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;<a class="struct" href="../serde/de/struct.IgnoredAny.html" title="struct serde::de::IgnoredAny">IgnoredAny</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><a class='srclink' href='../src/serde/de/ignored_any.rs.html#221-226' 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/trait.Deserialize.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>