<main><divclass="width-limiter"><navclass="sub"><formclass="search-form"><span></span><divid="sidebar-button"tabindex="-1"><ahref="../../serde/all.html"title="show sidebar"></a></div><inputclass="search-input"name="search"aria-label="Run search in the documentation"autocomplete="off"spellcheck="false"placeholder="Click or press ‘S’ to search, ‘?’ for more options…"type="search"><divid="help-button"tabindex="-1"><ahref="../../help.html"title="help">?</a></div><divid="settings-menu"tabindex="-1"><ahref="../../settings.html"title="settings"><imgwidth="22"height="22"alt="Change settings"src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><sectionid="main-content"class="content"><divclass="main-heading"><h1>Module <ahref="../index.html">serde</a>::<wbr><aclass="mod"href="#">de</a><buttonid="copy-path"title="Copy item path to clipboard"><imgsrc="../../static.files/clipboard-7571035ce49a181d.svg"width="19"height="18"alt="Copy item path"></button></h1><spanclass="out-of-band"><aclass="src"href="../../src/serde/de/mod.rs.html#1-2325">source</a> · <buttonid="toggle-all-docs"title="collapse all docs">[<span>−</span>]</button></span></div><detailsclass="toggle top-doc"open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>Generic data structure deserialization framework.</p>
<p>The two most important traits in this module are <ahref="../trait.Deserialize.html"><code>Deserialize</code></a> and
<p>Serde provides <ahref="../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 <ahref="https://crates.io/crates/serde_derive"><code>serde_derive</code></a> to
automatically generate <ahref="../trait.Deserialize.html"><code>Deserialize</code></a> implementations for structs and enums
in your program. See the <ahref="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 <ahref="../trait.Deserialize.html"><code>Deserialize</code></a> manually for
some type in your program. See the <ahref="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 <ahref="../trait.Deserialize.html"><code>Deserialize</code></a> implementations for types
that they expose. For example the <ahref="https://crates.io/crates/linked-hash-map"><code>linked-hash-map</code></a> crate provides a
<ahref="https://docs.rs/linked-hash-map/*/linked_hash_map/struct.LinkedHashMap.html"><code>LinkedHashMap<K, V></code></a> type that is deserializable by Serde because the
crate provides an implementation of <ahref="../trait.Deserialize.html"><code>Deserialize</code></a> for it.</p>
<p><ahref="../trait.Deserializer.html"><code>Deserializer</code></a> implementations are provided by third-party crates, for
example <ahref="https://github.com/serde-rs/json"><code>serde_json</code></a>, <ahref="https://github.com/dtolnay/serde-yaml"><code>serde_yaml</code></a> and <ahref="https://github.com/jamesmunns/postcard"><code>postcard</code></a>.</p>
<p>A partial list of well-maintained formats is given on the <ahref="https://serde.rs/#data-formats">Serde
<h2id="implementations-of-deserialize-provided-by-serde"><aclass="doc-anchor"href="#implementations-of-deserialize-provided-by-serde">§</a>Implementations of Deserialize provided by Serde</h2>
</div></details><h2id="reexports"class="section-header">Re-exports<ahref="#reexports"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"id="reexport.StdError"><code>pub use std::error::<aclass="trait"href="https://doc.rust-lang.org/1.77.0/core/error/trait.Error.html"title="trait core::error::Error">Error</a> as StdError;</code></div></li></ul><h2id="modules"class="section-header">Modules<ahref="#modules"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="mod"href="value/index.html"title="mod serde::de::value">value</a></div><divclass="desc docblock-short">Building blocks for deserializing basic values using the <code>IntoDeserializer</code>
trait.</div></li></ul><h2id="structs"class="section-header">Structs<ahref="#structs"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="struct"href="struct.IgnoredAny.html"title="struct serde::de::IgnoredAny">IgnoredAny</a></div><divclass="desc docblock-short">An efficient way of discarding data from a deserializer.</div></li></ul><h2id="enums"class="section-header">Enums<ahref="#enums"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="enum"href="enum.Unexpected.html"title="enum serde::de::Unexpected">Unexpected</a></div><divclass="desc docblock-short"><code>Unexpected</code> represents an unexpected invocation of any one of the <code>Visitor</code>
trait methods.</div></li></ul><h2id="traits"class="section-header">Traits<ahref="#traits"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="trait"href="trait.Deserialize.html"title="trait serde::de::Deserialize">Deserialize</a></div><divclass="desc docblock-short">A <strong>data structure</strong> that can be deserialized from any data format supported
by Serde.</div></li><li><divclass="item-name"><aclass="trait"href="trait.DeserializeOwned.html"title="trait serde::de::DeserializeOwned">DeserializeOwned</a></div><divclass="desc docblock-short">A data structure that can be deserialized without borrowing any data from
the deserializer.</div></li><li><divclass="item-name"><aclass="trait"href="trait.DeserializeSeed.html"title="trait serde::de::DeserializeSeed">DeserializeSeed</a></div><divclass="desc docblock-short"><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.</div></li><li><divclass="item-name"><aclass="trait"href="trait.Deserializer.html"title="trait serde::de::Deserializer">Deserializer</a></div><divclass="desc docblock-short">A <strong>data format</strong> that can deserialize any data structure supported by
Serde.</div></li><li><divclass="item-name"><aclass="trait"href="trait.EnumAccess.html"title="trait serde::de::EnumAccess">EnumAccess</a></div><divclass="desc docblock-short">Provides a <code>Visitor</code> access to the data of an enum in the input.</div></li><li><divclass="item-name"><aclass="trait"href="trait.Error.html"title="trait serde::de::Error">Error</a></div><divclass="desc docblock-short">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.</div></li><li><divclass="item-name"><aclass="trait"href="trait.Expected.html"title="trait serde::de::Expected">Expected</a></div><divclass="desc docblock-short"><code>Expected</code> represents an explanation of what data a <code>Visitor</code> was expecting
to receive.</div></li><li><divclass="item-name"><aclass="trait"href="trait.IntoDeserializer.html"title="trait serde::de::IntoDeserializer">IntoDeserializer</a></div><divclass="desc docblock-short">Converts an existing value into a <code>Deserializer</code> from which other values can
be deserialized.</div></li><li><divclass="item-name"><aclass="trait"href="trait.MapAccess.html"title="trait serde::de::MapAccess">MapAccess</a></div><divclass="desc docblock-short">Provides a <code>Visitor</code> access to each entry of a map in the input.</div></li><li><divclass="item-name"><aclass="trait"href="trait.SeqAccess.html"title="trait serde::de::SeqAccess">SeqAccess</a></div><divclass="desc docblock-short">Provides a <code>Visitor</code> access to each element of a sequence in the input.</div></li><li><divclass="item-name"><aclass="trait"href="trait.VariantAccess.html"title="trait serde::de::VariantAccess">VariantAccess</a></div><divclass="desc docblock-short"><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.</div></li><li><divclass="item-name"><aclass="trait"href="trait.Visitor.html"title="trait serde::de::Visitor">Visitor</a></div><divclass="desc docblock-short">This trait represents a visitor that walks through a deserializer.</div></li></ul></section></div></main></body></html>