Adding large folders

This commit is contained in:
2026-02-26 12:00:21 -05:00
parent 5400d82acd
commit 49701c85ad
47332 changed files with 1942573 additions and 0 deletions

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,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../serde_core/de/struct.IgnoredAny.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../serde_core/de/struct.IgnoredAny.html">../../../serde_core/de/struct.IgnoredAny.html</a>...</p>
<script>location.replace("../../../serde_core/de/struct.IgnoredAny.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,133 @@
<!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="Generic data structure deserialization framework."><title>serde_core::de - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module de</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module de</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#the-deserialize-trait" title="The Deserialize trait">The Deserialize trait</a></li><li><a href="#the-deserializer-trait" title="The Deserializer trait">The Deserializer trait</a></li><li><a href="#implementations-of-deserialize-provided-by-serde" title="Implementations of Deserialize provided by Serde">Implementations of Deserialize provided by Serde</a></li></ul><h3><a href="#reexports">Module Items</a></h3><ul class="block"><li><a href="#reexports" title="Re-exports">Re-exports</a></li><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate serde_<wbr>core</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">serde_core</a></div><h1>Module <span>de</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/serde_core/de/mod.rs.html#1-2392">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><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" title="trait serde_core::Deserialize"><code>Deserialize</code></a> and
<a href="../trait.Deserializer.html" title="trait serde_core::Deserializer"><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>
<h2 id="the-deserialize-trait"><a class="doc-anchor" href="#the-deserialize-trait">§</a>The Deserialize trait</h2>
<p>Serde provides <a href="../trait.Deserialize.html" title="trait serde_core::Deserialize"><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" title="trait serde_core::Deserialize"><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" title="trait serde_core::Deserialize"><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" title="trait serde_core::Deserialize"><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" title="trait serde_core::Deserialize"><code>Deserialize</code></a> for it.</p>
<h2 id="the-deserializer-trait"><a class="doc-anchor" href="#the-deserializer-trait">§</a>The Deserializer trait</h2>
<p><a href="../trait.Deserializer.html" title="trait serde_core::Deserializer"><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/jamesmunns/postcard"><code>postcard</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>
<h2 id="implementations-of-deserialize-provided-by-serde"><a class="doc-anchor" href="#implementations-of-deserialize-provided-by-serde">§</a>Implementations of Deserialize provided by Serde</h2>
<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 = [“rc”] <em>is enabled)</em></li>
<li>Arc&lt;T&gt;<em>(if</em> features = [“rc”] <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></details><h2 id="reexports" class="section-header">Re-exports<a href="#reexports" class="anchor">§</a></h2><dl class="item-table reexports"><dt id="reexport.StdError"><code>pub use std::error::<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/error/trait.Error.html" title="trait core::error::Error">Error</a> as StdError;</code></dt></dl><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="value/index.html" title="mod serde_core::de::value">value</a></dt><dd>Building blocks for deserializing basic values using the <code>IntoDeserializer</code>
trait.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.IgnoredAny.html" title="struct serde_core::de::IgnoredAny">Ignored<wbr>Any</a></dt><dd>An efficient way of discarding data from a deserializer.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.Unexpected.html" title="enum serde_core::de::Unexpected">Unexpected</a></dt><dd><code>Unexpected</code> represents an unexpected invocation of any one of the <code>Visitor</code>
trait methods.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.Deserialize.html" title="trait serde_core::de::Deserialize">Deserialize</a></dt><dd>A <strong>data structure</strong> that can be deserialized from any data format supported
by Serde.</dd><dt><a class="trait" href="trait.DeserializeOwned.html" title="trait serde_core::de::DeserializeOwned">Deserialize<wbr>Owned</a></dt><dd>A data structure that can be deserialized without borrowing any data from
the deserializer.</dd><dt><a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">Deserialize<wbr>Seed</a></dt><dd><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.</dd><dt><a class="trait" href="trait.Deserializer.html" title="trait serde_core::de::Deserializer">Deserializer</a></dt><dd>A <strong>data format</strong> that can deserialize any data structure supported by
Serde.</dd><dt><a class="trait" href="trait.EnumAccess.html" title="trait serde_core::de::EnumAccess">Enum<wbr>Access</a></dt><dd>Provides a <code>Visitor</code> access to the data of an enum in the input.</dd><dt><a class="trait" href="trait.Error.html" title="trait serde_core::de::Error">Error</a></dt><dd>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.</dd><dt><a class="trait" href="trait.Expected.html" title="trait serde_core::de::Expected">Expected</a></dt><dd><code>Expected</code> represents an explanation of what data a <code>Visitor</code> was expecting
to receive.</dd><dt><a class="trait" href="trait.IntoDeserializer.html" title="trait serde_core::de::IntoDeserializer">Into<wbr>Deserializer</a></dt><dd>Converts an existing value into a <code>Deserializer</code> from which other values can
be deserialized.</dd><dt><a class="trait" href="trait.MapAccess.html" title="trait serde_core::de::MapAccess">MapAccess</a></dt><dd>Provides a <code>Visitor</code> access to each entry of a map in the input.</dd><dt><a class="trait" href="trait.SeqAccess.html" title="trait serde_core::de::SeqAccess">SeqAccess</a></dt><dd>Provides a <code>Visitor</code> access to each element of a sequence in the input.</dd><dt><a class="trait" href="trait.VariantAccess.html" title="trait serde_core::de::VariantAccess">Variant<wbr>Access</a></dt><dd><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.</dd><dt><a class="trait" href="trait.Visitor.html" title="trait serde_core::de::Visitor">Visitor</a></dt><dd>This trait represents a visitor that walks through a deserializer.</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"enum":["Unexpected"],"mod":["value"],"struct":["IgnoredAny"],"trait":["Deserialize","DeserializeOwned","DeserializeSeed","Deserializer","EnumAccess","Error","Expected","IntoDeserializer","MapAccess","SeqAccess","VariantAccess","Visitor"]};

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,20 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A data structure that can be deserialized without borrowing any data from the deserializer."><title>DeserializeOwned in serde_core::de - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">DeserializeOwned</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Deserialize<wbr>Owned</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#lifetime" title="Lifetime">Lifetime</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In serde_<wbr>core::<wbr>de</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">serde_core</a>::<wbr><a href="index.html">de</a></div><h1>Trait <span class="trait">Deserialize<wbr>Owned</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/serde_core/de/mod.rs.html#632">Source</a> </span></div><pre class="rust item-decl"><code>pub trait DeserializeOwned: for&lt;'de&gt; <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt; { }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><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>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>from_str&lt;<span class="lifetime">'a</span>, T&gt;(s: <span class="kw-2">&amp;</span><span class="lifetime">'a </span>str) -&gt; <span class="prelude-ty">Result</span>&lt;T&gt;
<span class="kw">where
</span>T: Deserialize&lt;<span class="lifetime">'a</span>&gt;;
<span class="kw">fn </span>from_reader&lt;R, T&gt;(rdr: R) -&gt; <span class="prelude-ty">Result</span>&lt;T&gt;
<span class="kw">where
</span>R: Read,
T: DeserializeOwned;</code></pre></div><h2 id="lifetime"><a class="doc-anchor" href="#lifetime">§</a>Lifetime</h2>
<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></details><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-DeserializeOwned-for-T" class="impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#633">Source</a><a href="#impl-DeserializeOwned-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="trait.DeserializeOwned.html" title="trait serde_core::de::DeserializeOwned">DeserializeOwned</a> for T<div class="where">where
T: for&lt;'de&gt; <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;,</div></h3></section></div><script src="../../trait.impl/serde_core/de/trait.DeserializeOwned.js" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,137 @@
<!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="`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."><title>DeserializeSeed in serde_core::de - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">DeserializeSeed</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Deserialize<wbr>Seed</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#lifetime" title="Lifetime">Lifetime</a></li><li><a href="#example" title="Example">Example</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Value" title="Value">Value</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.deserialize" title="deserialize">deserialize</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-DeserializeSeed%3C'de%3E-for-PhantomData%3CT%3E" title="PhantomData&#60;T&#62;">PhantomData&#60;T&#62;</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In serde_<wbr>core::<wbr>de</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">serde_core</a>::<wbr><a href="index.html">de</a></div><h1>Trait <span class="trait">Deserialize<wbr>Seed</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/serde_core/de/mod.rs.html#803-812">Source</a> </span></div><pre class="rust item-decl"><code>pub trait DeserializeSeed&lt;'de&gt;: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
type <a href="#associatedtype.Value" class="associatedtype">Value</a>;
// Required method
fn <a href="#tymethod.deserialize" class="fn">deserialize</a>&lt;D&gt;(self, deserializer: D) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>, D::<a class="associatedtype" href="../trait.Deserializer.html#associatedtype.Error" title="type serde_core::Deserializer::Error">Error</a>&gt;
<span class="where">where D: <a class="trait" href="../trait.Deserializer.html" title="trait serde_core::Deserializer">Deserializer</a>&lt;'de&gt;</span>;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><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>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>func&lt;<span class="lifetime">'de</span>, T: Deserialize&lt;<span class="lifetime">'de</span>&gt;&gt;() -&gt; <span class="prelude-ty">Result</span>&lt;T, Error&gt;</code></pre></div>
<p>Adjusting an API like this to support stateful deserialization is a matter
of accepting a seed as input:</p>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>func_seed&lt;<span class="lifetime">'de</span>, T: DeserializeSeed&lt;<span class="lifetime">'de</span>&gt;&gt;(seed: T) -&gt; <span class="prelude-ty">Result</span>&lt;T::Value, Error&gt;</code></pre></div>
<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>
<h2 id="lifetime"><a class="doc-anchor" href="#lifetime">§</a>Lifetime</h2>
<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>
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
<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>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>serde::de::{Deserialize, DeserializeSeed, Deserializer, SeqAccess, Visitor};
<span class="kw">use </span>std::fmt;
<span class="kw">use </span>std::marker::PhantomData;
<span class="comment">// A DeserializeSeed implementation that uses stateful deserialization to
// append array elements onto the end of an existing vector. The preexisting
// state ("seed") 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.
</span><span class="kw">struct </span>ExtendVec&lt;<span class="lifetime">'a</span>, T: <span class="lifetime">'a</span>&gt;(<span class="kw-2">&amp;</span><span class="lifetime">'a </span><span class="kw-2">mut </span>Vec&lt;T&gt;);
<span class="kw">impl</span>&lt;<span class="lifetime">'de</span>, <span class="lifetime">'a</span>, T&gt; DeserializeSeed&lt;<span class="lifetime">'de</span>&gt; <span class="kw">for </span>ExtendVec&lt;<span class="lifetime">'a</span>, T&gt;
<span class="kw">where
</span>T: Deserialize&lt;<span class="lifetime">'de</span>&gt;,
{
<span class="comment">// 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 ().
</span><span class="kw">type </span>Value = ();
<span class="kw">fn </span>deserialize&lt;D&gt;(<span class="self">self</span>, deserializer: D) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>::Value, D::Error&gt;
<span class="kw">where
</span>D: Deserializer&lt;<span class="lifetime">'de</span>&gt;,
{
<span class="comment">// Visitor implementation that will walk an inner array of the JSON
// input.
</span><span class="kw">struct </span>ExtendVecVisitor&lt;<span class="lifetime">'a</span>, T: <span class="lifetime">'a</span>&gt;(<span class="kw-2">&amp;</span><span class="lifetime">'a </span><span class="kw-2">mut </span>Vec&lt;T&gt;);
<span class="kw">impl</span>&lt;<span class="lifetime">'de</span>, <span class="lifetime">'a</span>, T&gt; Visitor&lt;<span class="lifetime">'de</span>&gt; <span class="kw">for </span>ExtendVecVisitor&lt;<span class="lifetime">'a</span>, T&gt;
<span class="kw">where
</span>T: Deserialize&lt;<span class="lifetime">'de</span>&gt;,
{
<span class="kw">type </span>Value = ();
<span class="kw">fn </span>expecting(<span class="kw-2">&amp;</span><span class="self">self</span>, formatter: <span class="kw-2">&amp;mut </span>fmt::Formatter) -&gt; fmt::Result {
<span class="macro">write!</span>(formatter, <span class="string">"an array of integers"</span>)
}
<span class="kw">fn </span>visit_seq&lt;A&gt;(<span class="self">self</span>, <span class="kw-2">mut </span>seq: A) -&gt; <span class="prelude-ty">Result</span>&lt;(), A::Error&gt;
<span class="kw">where
</span>A: SeqAccess&lt;<span class="lifetime">'de</span>&gt;,
{
<span class="comment">// Decrease the number of reallocations if there are many elements
</span><span class="kw">if let </span><span class="prelude-val">Some</span>(size_hint) = seq.size_hint() {
<span class="self">self</span>.<span class="number">0</span>.reserve(size_hint);
}
<span class="comment">// Visit each element in the inner array and push it onto
// the existing vector.
</span><span class="kw">while let </span><span class="prelude-val">Some</span>(elem) = seq.next_element()<span class="question-mark">? </span>{
<span class="self">self</span>.<span class="number">0</span>.push(elem);
}
<span class="prelude-val">Ok</span>(())
}
}
deserializer.deserialize_seq(ExtendVecVisitor(<span class="self">self</span>.<span class="number">0</span>))
}
}
<span class="comment">// Visitor implementation that will walk the outer array of the JSON input.
</span><span class="kw">struct </span>FlattenedVecVisitor&lt;T&gt;(PhantomData&lt;T&gt;);
<span class="kw">impl</span>&lt;<span class="lifetime">'de</span>, T&gt; Visitor&lt;<span class="lifetime">'de</span>&gt; <span class="kw">for </span>FlattenedVecVisitor&lt;T&gt;
<span class="kw">where
</span>T: Deserialize&lt;<span class="lifetime">'de</span>&gt;,
{
<span class="comment">// This Visitor constructs a single Vec&lt;T&gt; to hold the flattened
// contents of the inner arrays.
</span><span class="kw">type </span>Value = Vec&lt;T&gt;;
<span class="kw">fn </span>expecting(<span class="kw-2">&amp;</span><span class="self">self</span>, formatter: <span class="kw-2">&amp;mut </span>fmt::Formatter) -&gt; fmt::Result {
<span class="macro">write!</span>(formatter, <span class="string">"an array of arrays"</span>)
}
<span class="kw">fn </span>visit_seq&lt;A&gt;(<span class="self">self</span>, <span class="kw-2">mut </span>seq: A) -&gt; <span class="prelude-ty">Result</span>&lt;Vec&lt;T&gt;, A::Error&gt;
<span class="kw">where
</span>A: SeqAccess&lt;<span class="lifetime">'de</span>&gt;,
{
<span class="comment">// Create a single Vec to hold the flattened contents.
</span><span class="kw">let </span><span class="kw-2">mut </span>vec = Vec::new();
<span class="comment">// Each iteration through this loop is one inner array.
</span><span class="kw">while let </span><span class="prelude-val">Some</span>(()) = seq.next_element_seed(ExtendVec(<span class="kw-2">&amp;mut </span>vec))<span class="question-mark">? </span>{
<span class="comment">// Nothing to do; inner array has been appended into `vec`.
</span>}
<span class="comment">// Return the finished vec.
</span><span class="prelude-val">Ok</span>(vec)
}
}
<span class="kw">let </span>visitor = FlattenedVecVisitor(PhantomData);
<span class="kw">let </span>flattened: Vec&lt;u64&gt; = deserializer.deserialize_seq(visitor)<span class="question-mark">?</span>;</code></pre></div></div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Value" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#805">Source</a><h4 class="code-header">type <a href="#associatedtype.Value" class="associatedtype">Value</a></h4></section></summary><div class="docblock"><p>The type produced by using this seed.</p>
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.deserialize" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#809-811">Source</a><h4 class="code-header">fn <a href="#tymethod.deserialize" class="fn">deserialize</a>&lt;D&gt;(self, deserializer: D) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>, D::<a class="associatedtype" href="../trait.Deserializer.html#associatedtype.Error" title="type serde_core::Deserializer::Error">Error</a>&gt;<div class="where">where
D: <a class="trait" href="../trait.Deserializer.html" title="trait serde_core::Deserializer">Deserializer</a>&lt;'de&gt;,</div></h4></section></summary><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></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-DeserializeSeed%3C'de%3E-for-PhantomData%3CT%3E" class="impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#814-827">Source</a><a href="#impl-DeserializeSeed%3C'de%3E-for-PhantomData%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'de, T&gt; <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt; for <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/marker/struct.PhantomData.html" title="struct core::marker::PhantomData">PhantomData</a>&lt;T&gt;<div class="where">where
T: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Value-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#818">Source</a><a href="#associatedtype.Value-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Value" class="associatedtype">Value</a> = T</h4></section><section id="method.deserialize" class="method trait-impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#821-826">Source</a><a href="#method.deserialize" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.deserialize" class="fn">deserialize</a>&lt;D&gt;(self, deserializer: D) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, D::<a class="associatedtype" href="../trait.Deserializer.html#associatedtype.Error" title="type serde_core::Deserializer::Error">Error</a>&gt;<div class="where">where
D: <a class="trait" href="../trait.Deserializer.html" title="trait serde_core::Deserializer">Deserializer</a>&lt;'de&gt;,</div></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../../trait.impl/serde_core/de/trait.DeserializeSeed.js" data-ignore-extern-crates="core" async></script></section></div></main></body></html>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,46 @@
<!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="Provides a `Visitor` access to the data of an enum in the input."><title>EnumAccess in serde_core::de - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">EnumAccess</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Enum<wbr>Access</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#lifetime" title="Lifetime">Lifetime</a></li><li><a href="#example-implementation" title="Example implementation">Example implementation</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Error" title="Error">Error</a></li><li><a href="#associatedtype.Variant" title="Variant">Variant</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.variant_seed" title="variant_seed">variant_seed</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.variant" title="variant">variant</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In serde_<wbr>core::<wbr>de</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">serde_core</a>::<wbr><a href="index.html">de</a></div><h1>Trait <span class="trait">Enum<wbr>Access</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/serde_core/de/mod.rs.html#2035-2062">Source</a> </span></div><pre class="rust item-decl"><code>pub trait EnumAccess&lt;'de&gt;: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::de::Error">Error</a>;
type <a href="#associatedtype.Variant" class="associatedtype">Variant</a>: <a class="trait" href="trait.VariantAccess.html" title="trait serde_core::de::VariantAccess">VariantAccess</a>&lt;'de, Error = Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Error" title="type serde_core::de::EnumAccess::Error">Error</a>&gt;;
// Required method
fn <a href="#tymethod.variant_seed" class="fn">variant_seed</a>&lt;V&gt;(
self,
seed: V,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;(V::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>, Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Variant" title="type serde_core::de::EnumAccess::Variant">Variant</a>), Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Error" title="type serde_core::de::EnumAccess::Error">Error</a>&gt;
<span class="where">where V: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;</span>;
// Provided method
fn <a href="#method.variant" class="fn">variant</a>&lt;V&gt;(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;(V, Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Variant" title="type serde_core::de::EnumAccess::Variant">Variant</a>), Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Error" title="type serde_core::de::EnumAccess::Error">Error</a>&gt;
<span class="where">where V: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;</span> { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Provides a <code>Visitor</code> access to the data of an enum in the input.</p>
<p><code>EnumAccess</code> is created by the <code>Deserializer</code> and passed to the
<code>Visitor</code> in order to identify which variant of an enum to deserialize.</p>
<h2 id="lifetime"><a class="doc-anchor" href="#lifetime">§</a>Lifetime</h2>
<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>
<h2 id="example-implementation"><a class="doc-anchor" href="#example-implementation">§</a>Example implementation</h2>
<p>The <a href="https://serde.rs/data-format.html">example data format</a> presented on the website demonstrates an
implementation of <code>EnumAccess</code> for a basic JSON data format.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#2038">Source</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::de::Error">Error</a></h4></section></summary><div class="docblock"><p>The error type that can be returned if some error occurs during
deserialization.</p>
</div></details><details class="toggle" open><summary><section id="associatedtype.Variant" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#2041">Source</a><h4 class="code-header">type <a href="#associatedtype.Variant" class="associatedtype">Variant</a>: <a class="trait" href="trait.VariantAccess.html" title="trait serde_core::de::VariantAccess">VariantAccess</a>&lt;'de, Error = Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Error" title="type serde_core::de::EnumAccess::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>The <code>Visitor</code> that will be used to deserialize the content of the enum
variant.</p>
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.variant_seed" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#2047-2049">Source</a><h4 class="code-header">fn <a href="#tymethod.variant_seed" class="fn">variant_seed</a>&lt;V&gt;(
self,
seed: V,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;(V::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>, Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Variant" title="type serde_core::de::EnumAccess::Variant">Variant</a>), Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Error" title="type serde_core::de::EnumAccess::Error">Error</a>&gt;<div class="where">where
V: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;,</div></h4></section></summary><div class="docblock"><p><code>variant</code> is called to identify which variant to deserialize.</p>
<p><code>Deserialize</code> implementations should typically use <code>EnumAccess::variant</code>
instead.</p>
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.variant" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#2056-2061">Source</a><h4 class="code-header">fn <a href="#method.variant" class="fn">variant</a>&lt;V&gt;(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;(V, Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Variant" title="type serde_core::de::EnumAccess::Variant">Variant</a>), Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Error" title="type serde_core::de::EnumAccess::Error">Error</a>&gt;<div class="where">where
V: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;,</div></h4></section></summary><div class="docblock"><p><code>variant</code> is called to identify which variant to deserialize.</p>
<p>This method exists as a convenience for <code>Deserialize</code> implementations.
<code>EnumAccess</code> implementations should not override the default behavior.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-EnumAccess%3C'de%3E-for-CowStrDeserializer%3C'a,+E%3E" class="impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#844-857">Source</a><a href="#impl-EnumAccess%3C'de%3E-for-CowStrDeserializer%3C'a,+E%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'de, 'a, E&gt; <a class="trait" href="trait.EnumAccess.html" title="trait serde_core::de::EnumAccess">EnumAccess</a>&lt;'de&gt; for <a class="struct" href="value/struct.CowStrDeserializer.html" title="struct serde_core::de::value::CowStrDeserializer">CowStrDeserializer</a>&lt;'a, E&gt;<div class="where">where
E: <a class="trait" href="trait.Error.html" title="trait serde_core::de::Error">Error</a>,</div></h3><span class="item-info"><div class="stab portability">Available on <strong>crate features <code>std</code> or <code>alloc</code></strong> only.</div></span></section></summary><div class="impl-items"><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#848">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = E</h4></section><section id="associatedtype.Variant-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#849">Source</a><a href="#associatedtype.Variant-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Variant" class="associatedtype">Variant</a> = UnitOnly&lt;E&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-EnumAccess%3C'de%3E-for-StrDeserializer%3C'a,+E%3E" class="impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#518-531">Source</a><a href="#impl-EnumAccess%3C'de%3E-for-StrDeserializer%3C'a,+E%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'de, 'a, E&gt; <a class="trait" href="trait.EnumAccess.html" title="trait serde_core::de::EnumAccess">EnumAccess</a>&lt;'de&gt; for <a class="struct" href="value/struct.StrDeserializer.html" title="struct serde_core::de::value::StrDeserializer">StrDeserializer</a>&lt;'a, E&gt;<div class="where">where
E: <a class="trait" href="trait.Error.html" title="trait serde_core::de::Error">Error</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-2" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#522">Source</a><a href="#associatedtype.Error-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = E</h4></section><section id="associatedtype.Variant-2" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#523">Source</a><a href="#associatedtype.Variant-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Variant" class="associatedtype">Variant</a> = UnitOnly&lt;E&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-EnumAccess%3C'de%3E-for-MapAccessDeserializer%3CA%3E" class="impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#1665-1681">Source</a><a href="#impl-EnumAccess%3C'de%3E-for-MapAccessDeserializer%3CA%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'de, A&gt; <a class="trait" href="trait.EnumAccess.html" title="trait serde_core::de::EnumAccess">EnumAccess</a>&lt;'de&gt; for <a class="struct" href="value/struct.MapAccessDeserializer.html" title="struct serde_core::de::value::MapAccessDeserializer">MapAccessDeserializer</a>&lt;A&gt;<div class="where">where
A: <a class="trait" href="trait.MapAccess.html" title="trait serde_core::de::MapAccess">MapAccess</a>&lt;'de&gt;,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-3" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#1669">Source</a><a href="#associatedtype.Error-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = &lt;A as <a class="trait" href="trait.MapAccess.html" title="trait serde_core::de::MapAccess">MapAccess</a>&lt;'de&gt;&gt;::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a></h4></section><section id="associatedtype.Variant-3" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#1670">Source</a><a href="#associatedtype.Variant-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Variant" class="associatedtype">Variant</a> = MapAsEnum&lt;A&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-EnumAccess%3C'de%3E-for-BorrowedStrDeserializer%3C'de,+E%3E" class="impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#608-621">Source</a><a href="#impl-EnumAccess%3C'de%3E-for-BorrowedStrDeserializer%3C'de,+E%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'de, E&gt; <a class="trait" href="trait.EnumAccess.html" title="trait serde_core::de::EnumAccess">EnumAccess</a>&lt;'de&gt; for <a class="struct" href="value/struct.BorrowedStrDeserializer.html" title="struct serde_core::de::value::BorrowedStrDeserializer">BorrowedStrDeserializer</a>&lt;'de, E&gt;<div class="where">where
E: <a class="trait" href="trait.Error.html" title="trait serde_core::de::Error">Error</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-4" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#612">Source</a><a href="#associatedtype.Error-4" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = E</h4></section><section id="associatedtype.Variant-4" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#613">Source</a><a href="#associatedtype.Variant-4" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Variant" class="associatedtype">Variant</a> = UnitOnly&lt;E&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-EnumAccess%3C'de%3E-for-StringDeserializer%3CE%3E" class="impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#724-737">Source</a><a href="#impl-EnumAccess%3C'de%3E-for-StringDeserializer%3CE%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'de, E&gt; <a class="trait" href="trait.EnumAccess.html" title="trait serde_core::de::EnumAccess">EnumAccess</a>&lt;'de&gt; for <a class="struct" href="value/struct.StringDeserializer.html" title="struct serde_core::de::value::StringDeserializer">StringDeserializer</a>&lt;E&gt;<div class="where">where
E: <a class="trait" href="trait.Error.html" title="trait serde_core::de::Error">Error</a>,</div></h3><span class="item-info"><div class="stab portability">Available on <strong>crate features <code>std</code> or <code>alloc</code></strong> only.</div></span></section></summary><div class="impl-items"><section id="associatedtype.Error-5" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#728">Source</a><a href="#associatedtype.Error-5" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = E</h4></section><section id="associatedtype.Variant-5" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#729">Source</a><a href="#associatedtype.Variant-5" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Variant" class="associatedtype">Variant</a> = UnitOnly&lt;E&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-EnumAccess%3C'de%3E-for-U32Deserializer%3CE%3E" class="impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#418-431">Source</a><a href="#impl-EnumAccess%3C'de%3E-for-U32Deserializer%3CE%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'de, E&gt; <a class="trait" href="trait.EnumAccess.html" title="trait serde_core::de::EnumAccess">EnumAccess</a>&lt;'de&gt; for <a class="struct" href="value/struct.U32Deserializer.html" title="struct serde_core::de::value::U32Deserializer">U32Deserializer</a>&lt;E&gt;<div class="where">where
E: <a class="trait" href="trait.Error.html" title="trait serde_core::de::Error">Error</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-6" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#422">Source</a><a href="#associatedtype.Error-6" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = E</h4></section><section id="associatedtype.Variant-6" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#423">Source</a><a href="#associatedtype.Variant-6" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Variant" class="associatedtype">Variant</a> = UnitOnly&lt;E&gt;</h4></section></div></details></div><script src="../../trait.impl/serde_core/de/trait.EnumAccess.js" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,78 @@
<!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="The `Error` trait allows `Deserialize` implementations to create descriptive error messages belonging to the `Deserializer` against which they are currently running."><title>Error in serde_core::de - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Error</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Error</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example-implementation" title="Example implementation">Example implementation</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.custom" title="custom">custom</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.duplicate_field" title="duplicate_field">duplicate_field</a></li><li><a href="#method.invalid_length" title="invalid_length">invalid_length</a></li><li><a href="#method.invalid_type" title="invalid_type">invalid_type</a></li><li><a href="#method.invalid_value" title="invalid_value">invalid_value</a></li><li><a href="#method.missing_field" title="missing_field">missing_field</a></li><li><a href="#method.unknown_field" title="unknown_field">unknown_field</a></li><li><a href="#method.unknown_variant" title="unknown_variant">unknown_variant</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In serde_<wbr>core::<wbr>de</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">serde_core</a>::<wbr><a href="index.html">de</a></div><h1>Trait <span class="trait">Error</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/serde_core/de/mod.rs.html#304">Source</a> </span></div><pre class="rust item-decl"><code>pub trait Error: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/error/trait.Error.html" title="trait core::error::Error">StdError</a> {
// Required method
fn <a href="#tymethod.custom" class="fn">custom</a>&lt;T&gt;(msg: T) -&gt; Self
<span class="where">where T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a></span>;
// Provided methods
fn <a href="#method.invalid_type" class="fn">invalid_type</a>(unexp: <a class="enum" href="enum.Unexpected.html" title="enum serde_core::de::Unexpected">Unexpected</a>&lt;'_&gt;, exp: &amp;dyn <a class="trait" href="trait.Expected.html" title="trait serde_core::de::Expected">Expected</a>) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.invalid_value" class="fn">invalid_value</a>(unexp: <a class="enum" href="enum.Unexpected.html" title="enum serde_core::de::Unexpected">Unexpected</a>&lt;'_&gt;, exp: &amp;dyn <a class="trait" href="trait.Expected.html" title="trait serde_core::de::Expected">Expected</a>) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.invalid_length" class="fn">invalid_length</a>(len: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>, exp: &amp;dyn <a class="trait" href="trait.Expected.html" title="trait serde_core::de::Expected">Expected</a>) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.unknown_variant" class="fn">unknown_variant</a>(variant: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>, expected: &amp;'static [&amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>]) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.unknown_field" class="fn">unknown_field</a>(field: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>, expected: &amp;'static [&amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>]) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.missing_field" class="fn">missing_field</a>(field: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.duplicate_field" class="fn">duplicate_field</a>(field: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>) -&gt; Self { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><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>
<h2 id="example-implementation"><a class="doc-anchor" href="#example-implementation">§</a>Example implementation</h2>
<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></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.custom" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#304">Source</a><h4 class="code-header">fn <a href="#tymethod.custom" class="fn">custom</a>&lt;T&gt;(msg: T) -&gt; Self<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>,</div></h4></section></summary><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>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>serde::de::{<span class="self">self</span>, Deserialize, Deserializer};
<span class="kw">impl</span>&lt;<span class="lifetime">'de</span>&gt; Deserialize&lt;<span class="lifetime">'de</span>&gt; <span class="kw">for </span>IpAddr {
<span class="kw">fn </span>deserialize&lt;D&gt;(deserializer: D) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>, D::Error&gt;
<span class="kw">where
</span>D: Deserializer&lt;<span class="lifetime">'de</span>&gt;,
{
<span class="kw">let </span>s = String::deserialize(deserializer)<span class="question-mark">?</span>;
s.parse().map_err(de::Error::custom)
}
}</code></pre></div></div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.invalid_type" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#304">Source</a><h4 class="code-header">fn <a href="#method.invalid_type" class="fn">invalid_type</a>(unexp: <a class="enum" href="enum.Unexpected.html" title="enum serde_core::de::Unexpected">Unexpected</a>&lt;'_&gt;, exp: &amp;dyn <a class="trait" href="trait.Expected.html" title="trait serde_core::de::Expected">Expected</a>) -&gt; Self</h4></section></summary><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></details><details class="toggle method-toggle" open><summary><section id="method.invalid_value" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#304">Source</a><h4 class="code-header">fn <a href="#method.invalid_value" class="fn">invalid_value</a>(unexp: <a class="enum" href="enum.Unexpected.html" title="enum serde_core::de::Unexpected">Unexpected</a>&lt;'_&gt;, exp: &amp;dyn <a class="trait" href="trait.Expected.html" title="trait serde_core::de::Expected">Expected</a>) -&gt; Self</h4></section></summary><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></details><details class="toggle method-toggle" open><summary><section id="method.invalid_length" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#304">Source</a><h4 class="code-header">fn <a href="#method.invalid_length" class="fn">invalid_length</a>(len: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>, exp: &amp;dyn <a class="trait" href="trait.Expected.html" title="trait serde_core::de::Expected">Expected</a>) -&gt; Self</h4></section></summary><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></details><details class="toggle method-toggle" open><summary><section id="method.unknown_variant" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#304">Source</a><h4 class="code-header">fn <a href="#method.unknown_variant" class="fn">unknown_variant</a>(variant: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>, expected: &amp;'static [&amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>]) -&gt; Self</h4></section></summary><div class="docblock"><p>Raised when a <code>Deserialize</code> enum type received a variant with an
unrecognized name.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.unknown_field" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#304">Source</a><h4 class="code-header">fn <a href="#method.unknown_field" class="fn">unknown_field</a>(field: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>, expected: &amp;'static [&amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>]) -&gt; Self</h4></section></summary><div class="docblock"><p>Raised when a <code>Deserialize</code> struct type received a field with an
unrecognized name.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.missing_field" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#304">Source</a><h4 class="code-header">fn <a href="#method.missing_field" class="fn">missing_field</a>(field: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>) -&gt; Self</h4></section></summary><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></details><details class="toggle method-toggle" open><summary><section id="method.duplicate_field" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#304">Source</a><h4 class="code-header">fn <a href="#method.duplicate_field" class="fn">duplicate_field</a>(field: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Raised when a <code>Deserialize</code> struct type received more than one of the
same field.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-Error-for-Error" class="impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#61-82">Source</a><a href="#impl-Error-for-Error" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Error.html" title="trait serde_core::de::Error">Error</a> for <a class="struct" href="value/struct.Error.html" title="struct serde_core::de::value::Error">Error</a></h3></section></div><script src="../../trait.impl/serde_core/de/trait.Error.js" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,29 @@
<!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="`Expected` represents an explanation of what data a `Visitor` was expecting to receive."><title>Expected in serde_core::de - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Expected</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Expected</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.fmt" title="fmt">fmt</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-Expected-for-%26str" title="&#38;str">&#38;str</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Display-for-dyn+Expected" title="Display">Display</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In serde_<wbr>core::<wbr>de</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">serde_core</a>::<wbr><a href="index.html">de</a></div><h1>Trait <span class="trait">Expected</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/serde_core/de/mod.rs.html#484-488">Source</a> </span></div><pre class="rust item-decl"><code>pub trait Expected {
// Required method
fn <a href="#tymethod.fmt" class="fn">fmt</a>(&amp;self, formatter: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.93.1/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a>;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><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 “This
Visitor expects to receive …”, for example the message could be “an
integer between 0 and 64”. 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>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>visit_bool&lt;E&gt;(<span class="self">self</span>, v: bool) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>::Value, E&gt;
<span class="kw">where
</span>E: de::Error,
{
<span class="prelude-val">Err</span>(de::Error::invalid_type(Unexpected::Bool(v), <span class="kw-2">&amp;</span><span class="self">self</span>))
}</code></pre></div>
<p>Outside of a <code>Visitor</code>, <code>&amp;"..."</code> can be used.</p>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">return </span><span class="prelude-val">Err</span>(de::Error::invalid_type(
Unexpected::Bool(v),
<span class="kw-2">&amp;</span><span class="string">"a negative integer"</span>,
));</code></pre></div></div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.fmt" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#487">Source</a><h4 class="code-header">fn <a href="#tymethod.fmt" class="fn">fmt</a>(&amp;self, formatter: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.93.1/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><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></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Display-for-dyn+Expected" class="impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#505-509">Source</a><a href="#impl-Display-for-dyn+Expected" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for dyn <a class="trait" href="trait.Expected.html" title="trait serde_core::de::Expected">Expected</a> + '_</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#506-508">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Display.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, formatter: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.93.1/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></div></details></div></details></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-Expected-for-%26str" class="impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#499-503">Source</a><a href="#impl-Expected-for-%26str" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Expected.html" title="trait serde_core::de::Expected">Expected</a> for &amp;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a></h3></section></summary><div class="impl-items"><section id="method.fmt-1" class="method trait-impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#500-502">Source</a><a href="#method.fmt-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.fmt" class="fn">fmt</a>(&amp;self, formatter: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.93.1/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-Expected-for-T" class="impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#490-497">Source</a><a href="#impl-Expected-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;'de, T&gt; <a class="trait" href="trait.Expected.html" title="trait serde_core::de::Expected">Expected</a> for T<div class="where">where
T: <a class="trait" href="trait.Visitor.html" title="trait serde_core::de::Visitor">Visitor</a>&lt;'de&gt;,</div></h3></section></div><script src="../../trait.impl/serde_core/de/trait.Expected.js" data-ignore-extern-crates="std" async></script></section></div></main></body></html>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,101 @@
<!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="Provides a `Visitor` access to each entry of a map in the input."><title>MapAccess in serde_core::de - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">MapAccess</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">MapAccess</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#lifetime" title="Lifetime">Lifetime</a></li><li><a href="#example-implementation" title="Example implementation">Example implementation</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Error" title="Error">Error</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.next_key_seed" title="next_key_seed">next_key_seed</a></li><li><a href="#tymethod.next_value_seed" title="next_value_seed">next_value_seed</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.next_entry" title="next_entry">next_entry</a></li><li><a href="#method.next_entry_seed" title="next_entry_seed">next_entry_seed</a></li><li><a href="#method.next_key" title="next_key">next_key</a></li><li><a href="#method.next_value" title="next_value">next_value</a></li><li><a href="#method.size_hint" title="size_hint">size_hint</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-MapAccess%3C'de%3E-for-%26mut+A" title="&#38;mut A">&#38;mut A</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In serde_<wbr>core::<wbr>de</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">serde_core</a>::<wbr><a href="index.html">de</a></div><h1>Trait <span class="trait">MapAccess</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/serde_core/de/mod.rs.html#1837-1940">Source</a> </span></div><pre class="rust item-decl"><code>pub trait MapAccess&lt;'de&gt; {
type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::de::Error">Error</a>;
// Required methods
fn <a href="#tymethod.next_key_seed" class="fn">next_key_seed</a>&lt;K&gt;(
&amp;mut self,
seed: K,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;K::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>&gt;, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a>&gt;
<span class="where">where K: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;</span>;
<span class="item-spacer"></span> fn <a href="#tymethod.next_value_seed" class="fn">next_value_seed</a>&lt;V&gt;(&amp;mut self, seed: V) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;V::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a>&gt;
<span class="where">where V: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;</span>;
// Provided methods
fn <a href="#method.next_entry_seed" class="fn">next_entry_seed</a>&lt;K, V&gt;(
&amp;mut self,
kseed: K,
vseed: V,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(K::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>, V::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>)&gt;, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a>&gt;
<span class="where">where K: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;,
V: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.next_key" class="fn">next_key</a>&lt;K&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;K&gt;, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a>&gt;
<span class="where">where K: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.next_value" class="fn">next_value</a>&lt;V&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;V, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a>&gt;
<span class="where">where V: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.next_entry" class="fn">next_entry</a>&lt;K, V&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.tuple.html">(K, V)</a>&gt;, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a>&gt;
<span class="where">where K: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;,
V: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.size_hint" class="fn">size_hint</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt; { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Provides a <code>Visitor</code> access to each entry of a map in the input.</p>
<p>This is a trait that a <code>Deserializer</code> passes to a <code>Visitor</code> implementation.</p>
<h2 id="lifetime"><a class="doc-anchor" href="#lifetime">§</a>Lifetime</h2>
<p>The <code>'de</code> lifetime of this trait is the lifetime of data that may be
borrowed by deserialized map entries. See the page <a href="https://serde.rs/lifetimes.html">Understanding
deserializer lifetimes</a> for a more detailed explanation of these lifetimes.</p>
<h2 id="example-implementation"><a class="doc-anchor" href="#example-implementation">§</a>Example implementation</h2>
<p>The <a href="https://serde.rs/data-format.html">example data format</a> presented on the website demonstrates an
implementation of <code>MapAccess</code> for a basic JSON data format.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1840">Source</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::de::Error">Error</a></h4></section></summary><div class="docblock"><p>The error type that can be returned if some error occurs during
deserialization.</p>
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.next_key_seed" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1847-1849">Source</a><h4 class="code-header">fn <a href="#tymethod.next_key_seed" class="fn">next_key_seed</a>&lt;K&gt;(&amp;mut self, seed: K) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;K::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>&gt;, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a>&gt;<div class="where">where
K: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;,</div></h4></section></summary><div class="docblock"><p>This returns <code>Ok(Some(key))</code> for the next key in the map, or <code>Ok(None)</code>
if there are no more remaining entries.</p>
<p><code>Deserialize</code> implementations should typically use
<code>MapAccess::next_key</code> or <code>MapAccess::next_entry</code> instead.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.next_value_seed" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1860-1862">Source</a><h4 class="code-header">fn <a href="#tymethod.next_value_seed" class="fn">next_value_seed</a>&lt;V&gt;(&amp;mut self, seed: V) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;V::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a>&gt;<div class="where">where
V: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;,</div></h4></section></summary><div class="docblock"><p>This returns a <code>Ok(value)</code> for the next value in the map.</p>
<p><code>Deserialize</code> implementations should typically use
<code>MapAccess::next_value</code> instead.</p>
<h5 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h5>
<p>Calling <code>next_value_seed</code> before <code>next_key_seed</code> is incorrect and is
allowed to panic or return bogus results.</p>
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.next_entry_seed" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1873-1889">Source</a><h4 class="code-header">fn <a href="#method.next_entry_seed" class="fn">next_entry_seed</a>&lt;K, V&gt;(
&amp;mut self,
kseed: K,
vseed: V,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(K::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>, V::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>)&gt;, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a>&gt;<div class="where">where
K: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;,
V: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;,</div></h4></section></summary><div class="docblock"><p>This returns <code>Ok(Some((key, value)))</code> for the next (key-value) pair in
the map, or <code>Ok(None)</code> if there are no more remaining items.</p>
<p><code>MapAccess</code> implementations should override the default behavior if a
more efficient implementation is possible.</p>
<p><code>Deserialize</code> implementations should typically use
<code>MapAccess::next_entry</code> instead.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.next_key" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1897-1902">Source</a><h4 class="code-header">fn <a href="#method.next_key" class="fn">next_key</a>&lt;K&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;K&gt;, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a>&gt;<div class="where">where
K: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;,</div></h4></section></summary><div class="docblock"><p>This returns <code>Ok(Some(key))</code> for the next key in the map, or <code>Ok(None)</code>
if there are no more remaining entries.</p>
<p>This method exists as a convenience for <code>Deserialize</code> implementations.
<code>MapAccess</code> implementations should not override the default behavior.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.next_value" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1914-1919">Source</a><h4 class="code-header">fn <a href="#method.next_value" class="fn">next_value</a>&lt;V&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;V, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a>&gt;<div class="where">where
V: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;,</div></h4></section></summary><div class="docblock"><p>This returns a <code>Ok(value)</code> for the next value in the map.</p>
<p>This method exists as a convenience for <code>Deserialize</code> implementations.
<code>MapAccess</code> implementations should not override the default behavior.</p>
<h5 id="panics-1"><a class="doc-anchor" href="#panics-1">§</a>Panics</h5>
<p>Calling <code>next_value</code> before <code>next_key</code> is incorrect and is allowed to
panic or return bogus results.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.next_entry" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1927-1933">Source</a><h4 class="code-header">fn <a href="#method.next_entry" class="fn">next_entry</a>&lt;K, V&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.tuple.html">(K, V)</a>&gt;, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a>&gt;<div class="where">where
K: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;,
V: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;,</div></h4></section></summary><div class="docblock"><p>This returns <code>Ok(Some((key, value)))</code> for the next (key-value) pair in
the map, or <code>Ok(None)</code> if there are no more remaining items.</p>
<p>This method exists as a convenience for <code>Deserialize</code> implementations.
<code>MapAccess</code> implementations should not override the default behavior.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.size_hint" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1937-1939">Source</a><h4 class="code-header">fn <a href="#method.size_hint" class="fn">size_hint</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;</h4></section></summary><div class="docblock"><p>Returns the number of entries remaining in the map, if known.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-MapAccess%3C'de%3E-for-%26mut+A" class="impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1942-2006">Source</a><a href="#impl-MapAccess%3C'de%3E-for-%26mut+A" class="anchor">§</a><h3 class="code-header">impl&lt;'de, A&gt; <a class="trait" href="trait.MapAccess.html" title="trait serde_core::de::MapAccess">MapAccess</a>&lt;'de&gt; for <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut A</a><div class="where">where
A: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.MapAccess.html" title="trait serde_core::de::MapAccess">MapAccess</a>&lt;'de&gt;,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1946">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = &lt;A as <a class="trait" href="trait.MapAccess.html" title="trait serde_core::de::MapAccess">MapAccess</a>&lt;'de&gt;&gt;::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a></h4></section><section id="method.next_key_seed" class="method trait-impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1949-1954">Source</a><a href="#method.next_key_seed" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.next_key_seed" class="fn">next_key_seed</a>&lt;K&gt;(&amp;mut self, seed: K) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;K::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>&gt;, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a>&gt;<div class="where">where
K: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;,</div></h4></section><section id="method.next_value_seed" class="method trait-impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1957-1962">Source</a><a href="#method.next_value_seed" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.next_value_seed" class="fn">next_value_seed</a>&lt;V&gt;(&amp;mut self, seed: V) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;V::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a>&gt;<div class="where">where
V: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;,</div></h4></section><section id="method.next_entry_seed-1" class="method trait-impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1965-1975">Source</a><a href="#method.next_entry_seed-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.next_entry_seed" class="fn">next_entry_seed</a>&lt;K, V&gt;(
&amp;mut self,
kseed: K,
vseed: V,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(K::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>, V::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>)&gt;, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a>&gt;<div class="where">where
K: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;,
V: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;,</div></h4></section><section id="method.next_entry-1" class="method trait-impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1978-1984">Source</a><a href="#method.next_entry-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.next_entry" class="fn">next_entry</a>&lt;K, V&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.tuple.html">(K, V)</a>&gt;, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a>&gt;<div class="where">where
K: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;,
V: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;,</div></h4></section><section id="method.next_key-1" class="method trait-impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1987-1992">Source</a><a href="#method.next_key-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.next_key" class="fn">next_key</a>&lt;K&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;K&gt;, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a>&gt;<div class="where">where
K: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;,</div></h4></section><section id="method.next_value-1" class="method trait-impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1995-2000">Source</a><a href="#method.next_value-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.next_value" class="fn">next_value</a>&lt;V&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;V, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde_core::de::MapAccess::Error">Error</a>&gt;<div class="where">where
V: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;,</div></h4></section><section id="method.size_hint-1" class="method trait-impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#2003-2005">Source</a><a href="#method.size_hint-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.size_hint" class="fn">size_hint</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;</h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-MapAccess%3C'de%3E-for-MapDeserializer%3C'de,+I,+E%3E" class="impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#1353-1409">Source</a><a href="#impl-MapAccess%3C'de%3E-for-MapDeserializer%3C'de,+I,+E%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'de, I, E&gt; <a class="trait" href="trait.MapAccess.html" title="trait serde_core::de::MapAccess">MapAccess</a>&lt;'de&gt; for <a class="struct" href="value/struct.MapDeserializer.html" title="struct serde_core::de::value::MapDeserializer">MapDeserializer</a>&lt;'de, I, E&gt;<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,
I::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: Pair,
&lt;I::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as Pair&gt;::First: <a class="trait" href="trait.IntoDeserializer.html" title="trait serde_core::de::IntoDeserializer">IntoDeserializer</a>&lt;'de, E&gt;,
&lt;I::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as Pair&gt;::Second: <a class="trait" href="trait.IntoDeserializer.html" title="trait serde_core::de::IntoDeserializer">IntoDeserializer</a>&lt;'de, E&gt;,
E: <a class="trait" href="trait.Error.html" title="trait serde_core::de::Error">Error</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-2" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#1361">Source</a><a href="#associatedtype.Error-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = E</h4></section></div></details></div><script src="../../trait.impl/serde_core/de/trait.MapAccess.js" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,55 @@
<!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="Provides a `Visitor` access to each element of a sequence in the input."><title>SeqAccess in serde_core::de - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">SeqAccess</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">SeqAccess</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#lifetime" title="Lifetime">Lifetime</a></li><li><a href="#example-implementation" title="Example implementation">Example implementation</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Error" title="Error">Error</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.next_element_seed" title="next_element_seed">next_element_seed</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.next_element" title="next_element">next_element</a></li><li><a href="#method.size_hint" title="size_hint">size_hint</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-SeqAccess%3C'de%3E-for-%26mut+A" title="&#38;mut A">&#38;mut A</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In serde_<wbr>core::<wbr>de</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">serde_core</a>::<wbr><a href="index.html">de</a></div><h1>Trait <span class="trait">SeqAccess</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/serde_core/de/mod.rs.html#1749-1781">Source</a> </span></div><pre class="rust item-decl"><code>pub trait SeqAccess&lt;'de&gt; {
type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::de::Error">Error</a>;
// Required method
fn <a href="#tymethod.next_element_seed" class="fn">next_element_seed</a>&lt;T&gt;(
&amp;mut self,
seed: T,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;T::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>&gt;, Self::<a class="associatedtype" href="trait.SeqAccess.html#associatedtype.Error" title="type serde_core::de::SeqAccess::Error">Error</a>&gt;
<span class="where">where T: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;</span>;
// Provided methods
fn <a href="#method.next_element" class="fn">next_element</a>&lt;T&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;T&gt;, Self::<a class="associatedtype" href="trait.SeqAccess.html#associatedtype.Error" title="type serde_core::de::SeqAccess::Error">Error</a>&gt;
<span class="where">where T: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.size_hint" class="fn">size_hint</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt; { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Provides a <code>Visitor</code> access to each element of a sequence in the input.</p>
<p>This is a trait that a <code>Deserializer</code> passes to a <code>Visitor</code> implementation,
which deserializes each item in a sequence.</p>
<h2 id="lifetime"><a class="doc-anchor" href="#lifetime">§</a>Lifetime</h2>
<p>The <code>'de</code> lifetime of this trait is the lifetime of data that may be
borrowed by deserialized sequence elements. See the page <a href="https://serde.rs/lifetimes.html">Understanding
deserializer lifetimes</a> for a more detailed explanation of these lifetimes.</p>
<h2 id="example-implementation"><a class="doc-anchor" href="#example-implementation">§</a>Example implementation</h2>
<p>The <a href="https://serde.rs/data-format.html">example data format</a> presented on the website demonstrates an
implementation of <code>SeqAccess</code> for a basic JSON data format.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1752">Source</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::de::Error">Error</a></h4></section></summary><div class="docblock"><p>The error type that can be returned if some error occurs during
deserialization.</p>
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.next_element_seed" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1759-1761">Source</a><h4 class="code-header">fn <a href="#tymethod.next_element_seed" class="fn">next_element_seed</a>&lt;T&gt;(
&amp;mut self,
seed: T,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;T::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>&gt;, Self::<a class="associatedtype" href="trait.SeqAccess.html#associatedtype.Error" title="type serde_core::de::SeqAccess::Error">Error</a>&gt;<div class="where">where
T: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;,</div></h4></section></summary><div class="docblock"><p>This returns <code>Ok(Some(value))</code> for the next value in the sequence, or
<code>Ok(None)</code> if there are no more remaining items.</p>
<p><code>Deserialize</code> implementations should typically use
<code>SeqAccess::next_element</code> instead.</p>
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.next_element" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1769-1774">Source</a><h4 class="code-header">fn <a href="#method.next_element" class="fn">next_element</a>&lt;T&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;T&gt;, Self::<a class="associatedtype" href="trait.SeqAccess.html#associatedtype.Error" title="type serde_core::de::SeqAccess::Error">Error</a>&gt;<div class="where">where
T: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;,</div></h4></section></summary><div class="docblock"><p>This returns <code>Ok(Some(value))</code> for the next value in the sequence, or
<code>Ok(None)</code> if there are no more remaining items.</p>
<p>This method exists as a convenience for <code>Deserialize</code> implementations.
<code>SeqAccess</code> implementations should not override the default behavior.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.size_hint" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1778-1780">Source</a><h4 class="code-header">fn <a href="#method.size_hint" class="fn">size_hint</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;</h4></section></summary><div class="docblock"><p>Returns the number of elements remaining in the sequence, if known.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-SeqAccess%3C'de%3E-for-%26mut+A" class="impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1783-1809">Source</a><a href="#impl-SeqAccess%3C'de%3E-for-%26mut+A" class="anchor">§</a><h3 class="code-header">impl&lt;'de, A&gt; <a class="trait" href="trait.SeqAccess.html" title="trait serde_core::de::SeqAccess">SeqAccess</a>&lt;'de&gt; for <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut A</a><div class="where">where
A: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.SeqAccess.html" title="trait serde_core::de::SeqAccess">SeqAccess</a>&lt;'de&gt;,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1787">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = &lt;A as <a class="trait" href="trait.SeqAccess.html" title="trait serde_core::de::SeqAccess">SeqAccess</a>&lt;'de&gt;&gt;::<a class="associatedtype" href="trait.SeqAccess.html#associatedtype.Error" title="type serde_core::de::SeqAccess::Error">Error</a></h4></section><section id="method.next_element_seed" class="method trait-impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1790-1795">Source</a><a href="#method.next_element_seed" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.next_element_seed" class="fn">next_element_seed</a>&lt;T&gt;(
&amp;mut self,
seed: T,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;T::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>&gt;, Self::<a class="associatedtype" href="trait.SeqAccess.html#associatedtype.Error" title="type serde_core::de::SeqAccess::Error">Error</a>&gt;<div class="where">where
T: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;,</div></h4></section><section id="method.next_element-1" class="method trait-impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1798-1803">Source</a><a href="#method.next_element-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.next_element" class="fn">next_element</a>&lt;T&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;T&gt;, Self::<a class="associatedtype" href="trait.SeqAccess.html#associatedtype.Error" title="type serde_core::de::SeqAccess::Error">Error</a>&gt;<div class="where">where
T: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;,</div></h4></section><section id="method.size_hint-1" class="method trait-impl"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#1806-1808">Source</a><a href="#method.size_hint-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.size_hint" class="fn">size_hint</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>&gt;</h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-SeqAccess%3C'de%3E-for-MapDeserializer%3C'de,+I,+E%3E" class="impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#1411-1437">Source</a><a href="#impl-SeqAccess%3C'de%3E-for-MapDeserializer%3C'de,+I,+E%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'de, I, E&gt; <a class="trait" href="trait.SeqAccess.html" title="trait serde_core::de::SeqAccess">SeqAccess</a>&lt;'de&gt; for <a class="struct" href="value/struct.MapDeserializer.html" title="struct serde_core::de::value::MapDeserializer">MapDeserializer</a>&lt;'de, I, E&gt;<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>,
I::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: Pair,
&lt;I::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as Pair&gt;::First: <a class="trait" href="trait.IntoDeserializer.html" title="trait serde_core::de::IntoDeserializer">IntoDeserializer</a>&lt;'de, E&gt;,
&lt;I::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as Pair&gt;::Second: <a class="trait" href="trait.IntoDeserializer.html" title="trait serde_core::de::IntoDeserializer">IntoDeserializer</a>&lt;'de, E&gt;,
E: <a class="trait" href="trait.Error.html" title="trait serde_core::de::Error">Error</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-2" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#1419">Source</a><a href="#associatedtype.Error-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = E</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-SeqAccess%3C'de%3E-for-SeqDeserializer%3CI,+E%3E" class="impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#1082-1106">Source</a><a href="#impl-SeqAccess%3C'de%3E-for-SeqDeserializer%3CI,+E%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'de, I, T, E&gt; <a class="trait" href="trait.SeqAccess.html" title="trait serde_core::de::SeqAccess">SeqAccess</a>&lt;'de&gt; for <a class="struct" href="value/struct.SeqDeserializer.html" title="struct serde_core::de::value::SeqDeserializer">SeqDeserializer</a>&lt;I, E&gt;<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = T&gt;,
T: <a class="trait" href="trait.IntoDeserializer.html" title="trait serde_core::de::IntoDeserializer">IntoDeserializer</a>&lt;'de, E&gt;,
E: <a class="trait" href="trait.Error.html" title="trait serde_core::de::Error">Error</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-3" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#1088">Source</a><a href="#associatedtype.Error-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = E</h4></section></div></details></div><script src="../../trait.impl/serde_core/de/trait.SeqAccess.js" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,101 @@
<!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="`VariantAccess` is a visitor that is created by the `Deserializer` and passed to the `Deserialize` to deserialize the content of a particular enum variant."><title>VariantAccess in serde_core::de - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">VariantAccess</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Variant<wbr>Access</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#lifetime" title="Lifetime">Lifetime</a></li><li><a href="#example-implementation" title="Example implementation">Example implementation</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Error" title="Error">Error</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.newtype_variant_seed" title="newtype_variant_seed">newtype_variant_seed</a></li><li><a href="#tymethod.struct_variant" title="struct_variant">struct_variant</a></li><li><a href="#tymethod.tuple_variant" title="tuple_variant">tuple_variant</a></li><li><a href="#tymethod.unit_variant" title="unit_variant">unit_variant</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.newtype_variant" title="newtype_variant">newtype_variant</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In serde_<wbr>core::<wbr>de</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">serde_core</a>::<wbr><a href="index.html">de</a></div><h1>Trait <span class="trait">Variant<wbr>Access</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/serde_core/de/mod.rs.html#2088-2280">Source</a> </span></div><pre class="rust item-decl"><code>pub trait VariantAccess&lt;'de&gt;: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::de::Error">Error</a>;
// Required methods
fn <a href="#tymethod.unit_variant" class="fn">unit_variant</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde_core::de::VariantAccess::Error">Error</a>&gt;;
<span class="item-spacer"></span> fn <a href="#tymethod.newtype_variant_seed" class="fn">newtype_variant_seed</a>&lt;T&gt;(self, seed: T) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde_core::de::VariantAccess::Error">Error</a>&gt;
<span class="where">where T: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;</span>;
<span class="item-spacer"></span> fn <a href="#tymethod.tuple_variant" class="fn">tuple_variant</a>&lt;V&gt;(
self,
len: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>,
visitor: V,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;V::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde_core::de::Visitor::Value">Value</a>, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde_core::de::VariantAccess::Error">Error</a>&gt;
<span class="where">where V: <a class="trait" href="trait.Visitor.html" title="trait serde_core::de::Visitor">Visitor</a>&lt;'de&gt;</span>;
<span class="item-spacer"></span> fn <a href="#tymethod.struct_variant" class="fn">struct_variant</a>&lt;V&gt;(
self,
fields: &amp;'static [&amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>],
visitor: V,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;V::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde_core::de::Visitor::Value">Value</a>, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde_core::de::VariantAccess::Error">Error</a>&gt;
<span class="where">where V: <a class="trait" href="trait.Visitor.html" title="trait serde_core::de::Visitor">Visitor</a>&lt;'de&gt;</span>;
// Provided method
fn <a href="#method.newtype_variant" class="fn">newtype_variant</a>&lt;T&gt;(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde_core::de::VariantAccess::Error">Error</a>&gt;
<span class="where">where T: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;</span> { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><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>
<h2 id="lifetime"><a class="doc-anchor" href="#lifetime">§</a>Lifetime</h2>
<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>
<h2 id="example-implementation"><a class="doc-anchor" href="#example-implementation">§</a>Example implementation</h2>
<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></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#2091">Source</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::de::Error">Error</a></h4></section></summary><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></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.unit_variant" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#2128">Source</a><h4 class="code-header">fn <a href="#tymethod.unit_variant" class="fn">unit_variant</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde_core::de::VariantAccess::Error">Error</a>&gt;</h4></section></summary><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>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>unit_variant(<span class="self">self</span>) -&gt; <span class="prelude-ty">Result</span>&lt;(), <span class="self">Self</span>::Error&gt; {
<span class="comment">// What the data actually contained; suppose it is a tuple variant.
</span><span class="kw">let </span>unexp = Unexpected::TupleVariant;
<span class="prelude-val">Err</span>(de::Error::invalid_type(unexp, <span class="kw-2">&amp;</span><span class="string">"unit variant"</span>))
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="tymethod.newtype_variant_seed" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#2170-2172">Source</a><h4 class="code-header">fn <a href="#tymethod.newtype_variant_seed" class="fn">newtype_variant_seed</a>&lt;T&gt;(self, seed: T) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde_core::de::DeserializeSeed::Value">Value</a>, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde_core::de::VariantAccess::Error">Error</a>&gt;<div class="where">where
T: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde_core::de::DeserializeSeed">DeserializeSeed</a>&lt;'de&gt;,</div></h4></section></summary><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>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>newtype_variant_seed&lt;T&gt;(<span class="self">self</span>, _seed: T) -&gt; <span class="prelude-ty">Result</span>&lt;T::Value, <span class="self">Self</span>::Error&gt;
<span class="kw">where
</span>T: DeserializeSeed&lt;<span class="lifetime">'de</span>&gt;,
{
<span class="comment">// What the data actually contained; suppose it is a unit variant.
</span><span class="kw">let </span>unexp = Unexpected::UnitVariant;
<span class="prelude-val">Err</span>(de::Error::invalid_type(unexp, <span class="kw-2">&amp;</span><span class="string">"newtype variant"</span>))
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="tymethod.tuple_variant" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#2226-2228">Source</a><h4 class="code-header">fn <a href="#tymethod.tuple_variant" class="fn">tuple_variant</a>&lt;V&gt;(
self,
len: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>,
visitor: V,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;V::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde_core::de::Visitor::Value">Value</a>, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde_core::de::VariantAccess::Error">Error</a>&gt;<div class="where">where
V: <a class="trait" href="trait.Visitor.html" title="trait serde_core::de::Visitor">Visitor</a>&lt;'de&gt;,</div></h4></section></summary><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>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>tuple_variant&lt;V&gt;(<span class="self">self</span>, _len: usize, _visitor: V) -&gt; <span class="prelude-ty">Result</span>&lt;V::Value, <span class="self">Self</span>::Error&gt;
<span class="kw">where
</span>V: Visitor&lt;<span class="lifetime">'de</span>&gt;,
{
<span class="comment">// What the data actually contained; suppose it is a unit variant.
</span><span class="kw">let </span>unexp = Unexpected::UnitVariant;
<span class="prelude-val">Err</span>(de::Error::invalid_type(unexp, <span class="kw-2">&amp;</span><span class="string">"tuple variant"</span>))
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="tymethod.struct_variant" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#2273-2279">Source</a><h4 class="code-header">fn <a href="#tymethod.struct_variant" class="fn">struct_variant</a>&lt;V&gt;(
self,
fields: &amp;'static [&amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>],
visitor: V,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;V::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde_core::de::Visitor::Value">Value</a>, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde_core::de::VariantAccess::Error">Error</a>&gt;<div class="where">where
V: <a class="trait" href="trait.Visitor.html" title="trait serde_core::de::Visitor">Visitor</a>&lt;'de&gt;,</div></h4></section></summary><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>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>struct_variant&lt;V&gt;(
<span class="self">self</span>,
_fields: <span class="kw-2">&amp;</span><span class="lifetime">'static </span>[<span class="kw-2">&amp;</span><span class="lifetime">'static </span>str],
_visitor: V,
) -&gt; <span class="prelude-ty">Result</span>&lt;V::Value, <span class="self">Self</span>::Error&gt;
<span class="kw">where
</span>V: Visitor&lt;<span class="lifetime">'de</span>&gt;,
{
<span class="comment">// What the data actually contained; suppose it is a unit variant.
</span><span class="kw">let </span>unexp = Unexpected::UnitVariant;
<span class="prelude-val">Err</span>(de::Error::invalid_type(unexp, <span class="kw-2">&amp;</span><span class="string">"struct variant"</span>))
}</code></pre></div></div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.newtype_variant" class="method"><a class="src rightside" href="../../src/serde_core/de/mod.rs.html#2180-2185">Source</a><h4 class="code-header">fn <a href="#method.newtype_variant" class="fn">newtype_variant</a>&lt;T&gt;(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde_core::de::VariantAccess::Error">Error</a>&gt;<div class="where">where
T: <a class="trait" href="../trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a>&lt;'de&gt;,</div></h4></section></summary><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></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../../trait.impl/serde_core/de/trait.VariantAccess.js" async></script></section></div></main></body></html>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,38 @@
<!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="Building blocks for deserializing basic values using the `IntoDeserializer` trait."><title>serde_core::de::value - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module value</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module value</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In serde_<wbr>core::<wbr>de</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">serde_core</a>::<wbr><a href="../index.html">de</a></div><h1>Module <span>value</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/serde_core/de/value.rs.html#1-1895">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Building blocks for deserializing basic values using the <code>IntoDeserializer</code>
trait.</p>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>serde::de::{value, Deserialize, IntoDeserializer};
<span class="kw">use </span>serde_derive::Deserialize;
<span class="kw">use </span>std::str::FromStr;
<span class="attr">#[derive(Deserialize)]
</span><span class="kw">enum </span>Setting {
On,
Off,
}
<span class="kw">impl </span>FromStr <span class="kw">for </span>Setting {
<span class="kw">type </span><span class="prelude-val">Err </span>= value::Error;
<span class="kw">fn </span>from_str(s: <span class="kw-2">&amp;</span>str) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>, <span class="self">Self</span>::Err&gt; {
<span class="self">Self</span>::deserialize(s.into_deserializer())
}
}</code></pre></div></div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.BoolDeserializer.html" title="struct serde_core::de::value::BoolDeserializer">Bool<wbr>Deserializer</a></dt><dd>A deserializer holding
a <code>bool</code>.</dd><dt><a class="struct" href="struct.BorrowedBytesDeserializer.html" title="struct serde_core::de::value::BorrowedBytesDeserializer">Borrowed<wbr>Bytes<wbr>Deserializer</a></dt><dd>A deserializer holding a <code>&amp;[u8]</code> with a lifetime tied to another
deserializer. Always calls <a href="../trait.Visitor.html#method.visit_borrowed_bytes" title="method serde_core::de::Visitor::visit_borrowed_bytes"><code>Visitor::visit_borrowed_bytes</code></a>.</dd><dt><a class="struct" href="struct.BorrowedStrDeserializer.html" title="struct serde_core::de::value::BorrowedStrDeserializer">Borrowed<wbr>StrDeserializer</a></dt><dd>A deserializer holding a <code>&amp;str</code> with a lifetime tied to another
deserializer.</dd><dt><a class="struct" href="struct.BytesDeserializer.html" title="struct serde_core::de::value::BytesDeserializer">Bytes<wbr>Deserializer</a></dt><dd>A deserializer holding a <code>&amp;[u8]</code>. Always calls <a href="../trait.Visitor.html#method.visit_bytes" title="method serde_core::de::Visitor::visit_bytes"><code>Visitor::visit_bytes</code></a>.</dd><dt><a class="struct" href="struct.CharDeserializer.html" title="struct serde_core::de::value::CharDeserializer">Char<wbr>Deserializer</a></dt><dd>A deserializer holding
a <code>char</code>.</dd><dt><a class="struct" href="struct.CowStrDeserializer.html" title="struct serde_core::de::value::CowStrDeserializer">CowStr<wbr>Deserializer</a></dt><dd>A deserializer holding a <code>Cow&lt;str&gt;</code>.</dd><dt><a class="struct" href="struct.EnumAccessDeserializer.html" title="struct serde_core::de::value::EnumAccessDeserializer">Enum<wbr>Access<wbr>Deserializer</a></dt><dd>A deserializer holding an <code>EnumAccess</code>.</dd><dt><a class="struct" href="struct.Error.html" title="struct serde_core::de::value::Error">Error</a></dt><dd>A minimal representation of all possible errors that can occur using the
<code>IntoDeserializer</code> trait.</dd><dt><a class="struct" href="struct.F32Deserializer.html" title="struct serde_core::de::value::F32Deserializer">F32Deserializer</a></dt><dd>A deserializer holding
an <code>f32</code>.</dd><dt><a class="struct" href="struct.F64Deserializer.html" title="struct serde_core::de::value::F64Deserializer">F64Deserializer</a></dt><dd>A deserializer holding
an <code>f64</code>.</dd><dt><a class="struct" href="struct.I8Deserializer.html" title="struct serde_core::de::value::I8Deserializer">I8Deserializer</a></dt><dd>A deserializer holding
an <code>i8</code>.</dd><dt><a class="struct" href="struct.I16Deserializer.html" title="struct serde_core::de::value::I16Deserializer">I16Deserializer</a></dt><dd>A deserializer holding
an <code>i16</code>.</dd><dt><a class="struct" href="struct.I32Deserializer.html" title="struct serde_core::de::value::I32Deserializer">I32Deserializer</a></dt><dd>A deserializer holding
an <code>i32</code>.</dd><dt><a class="struct" href="struct.I64Deserializer.html" title="struct serde_core::de::value::I64Deserializer">I64Deserializer</a></dt><dd>A deserializer holding
an <code>i64</code>.</dd><dt><a class="struct" href="struct.I128Deserializer.html" title="struct serde_core::de::value::I128Deserializer">I128<wbr>Deserializer</a></dt><dd>A deserializer holding
an <code>i128</code>.</dd><dt><a class="struct" href="struct.IsizeDeserializer.html" title="struct serde_core::de::value::IsizeDeserializer">Isize<wbr>Deserializer</a></dt><dd>A deserializer holding
an <code>isize</code>.</dd><dt><a class="struct" href="struct.MapAccessDeserializer.html" title="struct serde_core::de::value::MapAccessDeserializer">MapAccess<wbr>Deserializer</a></dt><dd>A deserializer holding a <code>MapAccess</code>.</dd><dt><a class="struct" href="struct.MapDeserializer.html" title="struct serde_core::de::value::MapDeserializer">MapDeserializer</a></dt><dd>A deserializer that iterates over a map.</dd><dt><a class="struct" href="struct.SeqAccessDeserializer.html" title="struct serde_core::de::value::SeqAccessDeserializer">SeqAccess<wbr>Deserializer</a></dt><dd>A deserializer holding a <code>SeqAccess</code>.</dd><dt><a class="struct" href="struct.SeqDeserializer.html" title="struct serde_core::de::value::SeqDeserializer">SeqDeserializer</a></dt><dd>A deserializer that iterates over a sequence.</dd><dt><a class="struct" href="struct.StrDeserializer.html" title="struct serde_core::de::value::StrDeserializer">StrDeserializer</a></dt><dd>A deserializer holding a <code>&amp;str</code>.</dd><dt><a class="struct" href="struct.StringDeserializer.html" title="struct serde_core::de::value::StringDeserializer">String<wbr>Deserializer</a></dt><dd>A deserializer holding a <code>String</code>.</dd><dt><a class="struct" href="struct.U8Deserializer.html" title="struct serde_core::de::value::U8Deserializer">U8Deserializer</a></dt><dd>A deserializer holding
a <code>u8</code>.</dd><dt><a class="struct" href="struct.U16Deserializer.html" title="struct serde_core::de::value::U16Deserializer">U16Deserializer</a></dt><dd>A deserializer holding
a <code>u16</code>.</dd><dt><a class="struct" href="struct.U32Deserializer.html" title="struct serde_core::de::value::U32Deserializer">U32Deserializer</a></dt><dd>A deserializer holding a <code>u32</code>.</dd><dt><a class="struct" href="struct.U64Deserializer.html" title="struct serde_core::de::value::U64Deserializer">U64Deserializer</a></dt><dd>A deserializer holding
a <code>u64</code>.</dd><dt><a class="struct" href="struct.U128Deserializer.html" title="struct serde_core::de::value::U128Deserializer">U128<wbr>Deserializer</a></dt><dd>A deserializer holding
a <code>u128</code>.</dd><dt><a class="struct" href="struct.UnitDeserializer.html" title="struct serde_core::de::value::UnitDeserializer">Unit<wbr>Deserializer</a></dt><dd>A deserializer holding a <code>()</code>.</dd><dt><a class="struct" href="struct.UsizeDeserializer.html" title="struct serde_core::de::value::UsizeDeserializer">Usize<wbr>Deserializer</a></dt><dd>A deserializer holding
a <code>usize</code>.</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["BoolDeserializer","BorrowedBytesDeserializer","BorrowedStrDeserializer","BytesDeserializer","CharDeserializer","CowStrDeserializer","EnumAccessDeserializer","Error","F32Deserializer","F64Deserializer","I128Deserializer","I16Deserializer","I32Deserializer","I64Deserializer","I8Deserializer","IsizeDeserializer","MapAccessDeserializer","MapDeserializer","SeqAccessDeserializer","SeqDeserializer","StrDeserializer","StringDeserializer","U128Deserializer","U16Deserializer","U32Deserializer","U64Deserializer","U8Deserializer","UnitDeserializer","UsizeDeserializer"]};

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

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,27 @@
<!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="Serde is a framework for serializing and deserializing Rust data structures efficiently and generically."><title>serde_core - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Crate serde_core</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#modules">Crate Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#macros" title="Macros">Macros</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>serde_<wbr>core</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/serde_core/lib.rs.html#1-121">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Serde is a framework for <em><strong>ser</strong></em>ializing and <em><strong>de</strong></em>serializing Rust data
structures efficiently and generically.</p>
<p>The <code>serde_core</code> crate contains Serdes trait definitions with <strong>no support
for #[derive()]</strong>.</p>
<p>In crates that derive an implementation of <code>Serialize</code> or <code>Deserialize</code>, you
must depend on the <a href="https://crates.io/crates/serde"><code>serde</code></a> crate, not <code>serde_core</code>.</p>
<p>In crates that handwrite implementations of Serde traits, or only use them
as trait bounds, depending on <code>serde_core</code> is permitted. But <code>serde</code>
re-exports all of these traits and can be used for this use case too. If in
doubt, disregard <code>serde_core</code> and always use <code>serde</code>.</p>
<p>Crates that depend on <code>serde_core</code> instead of <code>serde</code> are able to compile in
parallel with <code>serde_derive</code> even when <code>serde</code>s “derive” feature is turned on,
as shown in the following build timings.</p>
<br>
<table>
<tr><td align="center">When <code>serde_json</code> depends on <code>serde</code></td></tr>
<tr><td><img src="https://github.com/user-attachments/assets/78dc179c-6ab1-4059-928c-1474b0d9d0bb"></td></tr>
</table>
<br>
<table>
<tr><td align="center">When <code>serde_json</code> depends on <code>serde_core</code></td></tr>
<tr><td><img src="https://github.com/user-attachments/assets/6b6cff5e-3e45-4ac7-9db1-d99ee8b9f5f7"></td></tr>
</table></div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="de/index.html" title="mod serde_core::de">de</a></dt><dd>Generic data structure deserialization framework.</dd><dt><a class="mod" href="ser/index.html" title="mod serde_core::ser">ser</a></dt><dd>Generic data structure serialization framework.</dd></dl><h2 id="macros" class="section-header">Macros<a href="#macros" class="anchor">§</a></h2><dl class="item-table"><dt><a class="macro" href="macro.forward_to_deserialize_any.html" title="macro serde_core::forward_to_deserialize_any">forward_<wbr>to_<wbr>deserialize_<wbr>any</a></dt><dd>Helper macro when implementing the <code>Deserializer</code> part of a new data format
for Serde.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.Deserialize.html" title="trait serde_core::Deserialize">Deserialize</a></dt><dd>A <strong>data structure</strong> that can be deserialized from any data format supported
by Serde.</dd><dt><a class="trait" href="trait.Deserializer.html" title="trait serde_core::Deserializer">Deserializer</a></dt><dd>A <strong>data format</strong> that can deserialize any data structure supported by
Serde.</dd><dt><a class="trait" href="trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a></dt><dd>A <strong>data structure</strong> that can be serialized into any data format supported
by Serde.</dd><dt><a class="trait" href="trait.Serializer.html" title="trait serde_core::Serializer">Serializer</a></dt><dd>A <strong>data format</strong> that can serialize any data structure supported by Serde.</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=macro.forward_to_deserialize_any.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="macro.forward_to_deserialize_any.html">macro.forward_to_deserialize_any.html</a>...</p>
<script>location.replace("macro.forward_to_deserialize_any.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,47 @@
<!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="Helper macro when implementing the `Deserializer` part of a new data format for Serde."><title>forward_to_deserialize_any in serde_core - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc macro"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">forward_to_deserialize_any</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">serde_core</a></div><h1>Macro <span class="macro">forward_<wbr>to_<wbr>deserialize_<wbr>any</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/serde_core/macros.rs.html#110-118">Source</a> </span></div><pre class="rust item-decl"><code>macro_rules! forward_to_deserialize_any {
(&lt;$visitor:ident: Visitor&lt;$lifetime:tt&gt;&gt; $($func:ident)*) =&gt; { ... };
($($func:ident)*) =&gt; { ... };
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Helper macro when implementing the <code>Deserializer</code> part of a new data format
for Serde.</p>
<p>Some <a href="trait.Deserializer.html" title="trait serde_core::Deserializer"><code>Deserializer</code></a> implementations for self-describing formats do not
care what hint the <a href="de/trait.Visitor.html" title="trait serde_core::de::Visitor"><code>Visitor</code></a> gives them, they just want to blindly call
the <a href="de/trait.Visitor.html" title="trait serde_core::de::Visitor"><code>Visitor</code></a> method corresponding to the data they can tell is in the
input. This requires repetitive implementations of all the <a href="trait.Deserializer.html" title="trait serde_core::Deserializer"><code>Deserializer</code></a>
trait methods.</p>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="attr">#[inline]
</span><span class="kw">fn </span>deserialize_bool&lt;V&gt;(<span class="self">self</span>, visitor: V) -&gt; <span class="prelude-ty">Result</span>&lt;V::Value, <span class="self">Self</span>::Error&gt;
<span class="kw">where
</span>V: Visitor&lt;<span class="lifetime">'de</span>&gt;,
{
<span class="self">self</span>.deserialize_any(visitor)
}</code></pre></div>
<p>The <code>forward_to_deserialize_any!</code> macro implements these simple forwarding
methods so that they forward directly to <a href="trait.Deserializer.html#tymethod.deserialize_any" title="method serde_core::Deserializer::deserialize_any"><code>Deserializer::deserialize_any</code></a>.
You can choose which methods to forward.</p>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">impl</span>&lt;<span class="lifetime">'de</span>&gt; Deserializer&lt;<span class="lifetime">'de</span>&gt; <span class="kw">for </span>MyDeserializer {
<span class="kw">fn </span>deserialize_any&lt;V&gt;(<span class="self">self</span>, visitor: V) -&gt; <span class="prelude-ty">Result</span>&lt;V::Value, <span class="self">Self</span>::Error&gt;
<span class="kw">where
</span>V: Visitor&lt;<span class="lifetime">'de</span>&gt;,
{
<span class="comment">/* ... */
</span>}
<span class="macro">forward_to_deserialize_any!</span> {
bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string
bytes byte_buf option unit unit_struct newtype_struct seq tuple
tuple_struct map <span class="kw">struct enum </span>identifier ignored_any
}
}</code></pre></div>
<p>The macro assumes the convention that your <code>Deserializer</code> lifetime parameter
is called <code>'de</code> and that the <code>Visitor</code> type parameters on each method are
called <code>V</code>. A different type parameter and a different lifetime can be
specified explicitly if necessary.</p>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="macro">forward_to_deserialize_any!</span> {
&lt;W: Visitor&lt;<span class="lifetime">'q</span>&gt;&gt;
bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string
bytes byte_buf option unit unit_struct newtype_struct seq tuple
tuple_struct map <span class="kw">struct enum </span>identifier ignored_any
}</code></pre></div></div></details></section></div></main></body></html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../../serde_core/ser/struct.Impossible.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../../serde_core/ser/struct.Impossible.html">../../../serde_core/ser/struct.Impossible.html</a>...</p>
<script>location.replace("../../../serde_core/ser/struct.Impossible.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,117 @@
<!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="Generic data structure serialization framework."><title>serde_core::ser - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module ser</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module ser</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#the-serialize-trait" title="The Serialize trait">The Serialize trait</a></li><li><a href="#the-serializer-trait" title="The Serializer trait">The Serializer trait</a></li><li><a href="#implementations-of-serialize-provided-by-serde" title="Implementations of Serialize provided by Serde">Implementations of Serialize provided by Serde</a></li></ul><h3><a href="#reexports">Module Items</a></h3><ul class="block"><li><a href="#reexports" title="Re-exports">Re-exports</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate serde_<wbr>core</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">serde_core</a></div><h1>Module <span>ser</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/serde_core/ser/mod.rs.html#1-2010">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Generic data structure serialization framework.</p>
<p>The two most important traits in this module are <a href="../trait.Serialize.html" title="trait serde_core::Serialize"><code>Serialize</code></a> and
<a href="../trait.Serializer.html" title="trait serde_core::Serializer"><code>Serializer</code></a>.</p>
<ul>
<li><strong>A type that implements <code>Serialize</code> is a data structure</strong> that can be
serialized to any data format supported by Serde, and conversely</li>
<li><strong>A type that implements <code>Serializer</code> is a data format</strong> that can
serialize any data structure supported by Serde.</li>
</ul>
<h2 id="the-serialize-trait"><a class="doc-anchor" href="#the-serialize-trait">§</a>The Serialize trait</h2>
<p>Serde provides <a href="../trait.Serialize.html" title="trait serde_core::Serialize"><code>Serialize</code></a> implementations for many Rust primitive and
standard library types. The complete list is below. All of these can be
serialized 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.Serialize.html" title="trait serde_core::Serialize"><code>Serialize</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.Serialize.html" title="trait serde_core::Serialize"><code>Serialize</code></a> manually for
some type in your program. See the <a href="https://serde.rs/impl-serialize.html">Implementing <code>Serialize</code></a> section of the
manual for more about this.</p>
<p>Third-party crates may provide <a href="../trait.Serialize.html" title="trait serde_core::Serialize"><code>Serialize</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 serializable by Serde because the crate
provides an implementation of <a href="../trait.Serialize.html" title="trait serde_core::Serialize"><code>Serialize</code></a> for it.</p>
<h2 id="the-serializer-trait"><a class="doc-anchor" href="#the-serializer-trait">§</a>The Serializer trait</h2>
<p><a href="../trait.Serializer.html" title="trait serde_core::Serializer"><code>Serializer</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/jamesmunns/postcard"><code>postcard</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>
<h2 id="implementations-of-serialize-provided-by-serde"><a class="doc-anchor" href="#implementations-of-serialize-provided-by-serde">§</a>Implementations of Serialize provided by Serde</h2>
<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>
<li>str</li>
<li>&amp;T and &amp;mut T</li>
</ul>
</li>
<li><strong>Compound types</strong>:
<ul>
<li>[T]</li>
<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>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 = [“rc”] <em>is enabled)</em></li>
<li>Arc&lt;T&gt;<em>(if</em> features = [“rc”] <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>FFI types</strong>:
<ul>
<li>CStr</li>
<li>CString</li>
<li>OsStr</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></details><h2 id="reexports" class="section-header">Re-exports<a href="#reexports" class="anchor">§</a></h2><dl class="item-table reexports"><dt id="reexport.StdError"><code>pub use std::error::<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/error/trait.Error.html" title="trait core::error::Error">Error</a> as StdError;</code></dt></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Impossible.html" title="struct serde_core::ser::Impossible">Impossible</a></dt><dd>Helper type for implementing a <code>Serializer</code> that does not support
serializing one of the compound types.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a></dt><dd>Trait used by <code>Serialize</code> implementations to generically construct
errors belonging to the <code>Serializer</code> against which they are
currently running.</dd><dt><a class="trait" href="trait.Serialize.html" title="trait serde_core::ser::Serialize">Serialize</a></dt><dd>A <strong>data structure</strong> that can be serialized into any data format supported
by Serde.</dd><dt><a class="trait" href="trait.SerializeMap.html" title="trait serde_core::ser::SerializeMap">Serialize<wbr>Map</a></dt><dd>Returned from <code>Serializer::serialize_map</code>.</dd><dt><a class="trait" href="trait.SerializeSeq.html" title="trait serde_core::ser::SerializeSeq">Serialize<wbr>Seq</a></dt><dd>Returned from <code>Serializer::serialize_seq</code>.</dd><dt><a class="trait" href="trait.SerializeStruct.html" title="trait serde_core::ser::SerializeStruct">Serialize<wbr>Struct</a></dt><dd>Returned from <code>Serializer::serialize_struct</code>.</dd><dt><a class="trait" href="trait.SerializeStructVariant.html" title="trait serde_core::ser::SerializeStructVariant">Serialize<wbr>Struct<wbr>Variant</a></dt><dd>Returned from <code>Serializer::serialize_struct_variant</code>.</dd><dt><a class="trait" href="trait.SerializeTuple.html" title="trait serde_core::ser::SerializeTuple">Serialize<wbr>Tuple</a></dt><dd>Returned from <code>Serializer::serialize_tuple</code>.</dd><dt><a class="trait" href="trait.SerializeTupleStruct.html" title="trait serde_core::ser::SerializeTupleStruct">Serialize<wbr>Tuple<wbr>Struct</a></dt><dd>Returned from <code>Serializer::serialize_tuple_struct</code>.</dd><dt><a class="trait" href="trait.SerializeTupleVariant.html" title="trait serde_core::ser::SerializeTupleVariant">Serialize<wbr>Tuple<wbr>Variant</a></dt><dd>Returned from <code>Serializer::serialize_tuple_variant</code>.</dd><dt><a class="trait" href="trait.Serializer.html" title="trait serde_core::ser::Serializer">Serializer</a></dt><dd>A <strong>data format</strong> that can serialize any data structure supported by Serde.</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["Impossible"],"trait":["Error","Serialize","SerializeMap","SerializeSeq","SerializeStruct","SerializeStructVariant","SerializeTuple","SerializeTupleStruct","SerializeTupleVariant","Serializer"]};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,31 @@
<!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="Trait used by `Serialize` implementations to generically construct errors belonging to the `Serializer` against which they are currently running."><title>Error in serde_core::ser - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Error</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Error</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example-implementation" title="Example implementation">Example implementation</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.custom" title="custom">custom</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-Error-for-Error" title="Error">Error</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In serde_<wbr>core::<wbr>ser</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">serde_core</a>::<wbr><a href="index.html">ser</a></div><h1>Trait <span class="trait">Error</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/serde_core/ser/mod.rs.html#192">Source</a> </span></div><pre class="rust item-decl"><code>pub trait Error: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/error/trait.Error.html" title="trait core::error::Error">StdError</a> {
// Required method
fn <a href="#tymethod.custom" class="fn">custom</a>&lt;T&gt;(msg: T) -&gt; Self
<span class="where">where T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a></span>;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait used by <code>Serialize</code> implementations to generically construct
errors belonging to the <code>Serializer</code> against which they are
currently running.</p>
<h2 id="example-implementation"><a class="doc-anchor" href="#example-implementation">§</a>Example implementation</h2>
<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></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.custom" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#192">Source</a><h4 class="code-header">fn <a href="#tymethod.custom" class="fn">custom</a>&lt;T&gt;(msg: T) -&gt; Self<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>,</div></h4></section></summary><div class="docblock"><p>Used when a <a href="../trait.Serialize.html" title="trait serde_core::Serialize"><code>Serialize</code></a> implementation encounters any error
while serializing a type.</p>
<p>The message should not be capitalized and should not end with a
period.</p>
<p>For example, a filesystem <a href="https://doc.rust-lang.org/1.93.1/std/path/struct.Path.html" title="struct std::path::Path"><code>Path</code></a> may refuse to serialize
itself if it contains invalid UTF-8 data.</p>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>serde::ser::{<span class="self">self</span>, Serialize, Serializer};
<span class="kw">impl </span>Serialize <span class="kw">for </span>Path {
<span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
<span class="kw">where
</span>S: Serializer,
{
<span class="kw">match </span><span class="self">self</span>.to_str() {
<span class="prelude-val">Some</span>(s) =&gt; serializer.serialize_str(s),
<span class="prelude-val">None </span>=&gt; <span class="prelude-val">Err</span>(ser::Error::custom(<span class="string">"path contains invalid UTF-8 characters"</span>)),
}
}
}</code></pre></div></div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-Error-for-Error" class="impl"><a class="src rightside" href="../../src/serde_core/ser/fmt.rs.html#4-8">Source</a><a href="#impl-Error-for-Error" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a> for <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a></h3></section></summary><div class="impl-items"><section id="method.custom" class="method trait-impl"><a class="src rightside" href="../../src/serde_core/ser/fmt.rs.html#5-7">Source</a><a href="#method.custom" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.custom" class="fn">custom</a>&lt;T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>&gt;(_msg: T) -&gt; Self</h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-Error-for-Error-1" class="impl"><a class="src rightside" href="../../src/serde_core/de/value.rs.html#84-92">Source</a><a href="#impl-Error-for-Error-1" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a> for serde_core::de::value::<a class="struct" href="../de/value/struct.Error.html" title="struct serde_core::de::value::Error">Error</a></h3></section></div><script src="../../trait.impl/serde_core/ser/trait.Error.js" data-ignore-extern-crates="core" async></script></section></div></main></body></html>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,74 @@
<!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="Returned from `Serializer::serialize_map`."><title>SerializeMap in serde_core::ser - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">SerializeMap</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Serialize<wbr>Map</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example-use" title="Example use">Example use</a></li><li><a href="#example-implementation" title="Example implementation">Example implementation</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Error" title="Error">Error</a></li><li><a href="#associatedtype.Ok" title="Ok">Ok</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.end" title="end">end</a></li><li><a href="#tymethod.serialize_key" title="serialize_key">serialize_key</a></li><li><a href="#tymethod.serialize_value" title="serialize_value">serialize_value</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.serialize_entry" title="serialize_entry">serialize_entry</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In serde_<wbr>core::<wbr>ser</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">serde_core</a>::<wbr><a href="index.html">ser</a></div><h1>Trait <span class="trait">Serialize<wbr>Map</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/serde_core/ser/mod.rs.html#1811-1866">Source</a> </span></div><pre class="rust item-decl"><code>pub trait SerializeMap {
type <a href="#associatedtype.Ok" class="associatedtype">Ok</a>;
type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a>;
// Required methods
fn <a href="#tymethod.serialize_key" class="fn">serialize_key</a>&lt;T&gt;(&amp;mut self, key: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Error" title="type serde_core::ser::SerializeMap::Error">Error</a>&gt;
<span class="where">where T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a></span>;
<span class="item-spacer"></span> fn <a href="#tymethod.serialize_value" class="fn">serialize_value</a>&lt;T&gt;(&amp;mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Error" title="type serde_core::ser::SerializeMap::Error">Error</a>&gt;
<span class="where">where T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a></span>;
<span class="item-spacer"></span> fn <a href="#tymethod.end" class="fn">end</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Ok" title="type serde_core::ser::SerializeMap::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Error" title="type serde_core::ser::SerializeMap::Error">Error</a>&gt;;
// Provided method
fn <a href="#method.serialize_entry" class="fn">serialize_entry</a>&lt;K, V&gt;(
&amp;mut self,
key: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;K</a>,
value: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;V</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Error" title="type serde_core::ser::SerializeMap::Error">Error</a>&gt;
<span class="where">where K: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a>,
V: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a></span> { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returned from <code>Serializer::serialize_map</code>.</p>
<h2 id="example-use"><a class="doc-anchor" href="#example-use">§</a>Example use</h2>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>serde::ser::{Serialize, SerializeMap, Serializer};
<span class="kw">impl</span>&lt;K, V&gt; Serialize <span class="kw">for </span>HashMap&lt;K, V&gt;
<span class="kw">where
</span>K: Serialize,
V: Serialize,
{
<span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
<span class="kw">where
</span>S: Serializer,
{
<span class="kw">let </span><span class="kw-2">mut </span>map = serializer.serialize_map(<span class="prelude-val">Some</span>(<span class="self">self</span>.len()))<span class="question-mark">?</span>;
<span class="kw">for </span>(k, v) <span class="kw">in </span><span class="self">self </span>{
map.serialize_entry(k, v)<span class="question-mark">?</span>;
}
map.end()
}
}</code></pre></div><h2 id="example-implementation"><a class="doc-anchor" href="#example-implementation">§</a>Example implementation</h2>
<p>The <a href="https://serde.rs/data-format.html">example data format</a> presented on the website demonstrates an
implementation of <code>SerializeMap</code> for a basic JSON data format.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Ok" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1813">Source</a><h4 class="code-header">type <a href="#associatedtype.Ok" class="associatedtype">Ok</a></h4></section></summary><div class="docblock"><p>Must match the <code>Ok</code> type of our <code>Serializer</code>.</p>
</div></details><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1816">Source</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a></h4></section></summary><div class="docblock"><p>Must match the <code>Error</code> type of our <code>Serializer</code>.</p>
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_key" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1824-1826">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_key" class="fn">serialize_key</a>&lt;T&gt;(&amp;mut self, key: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Error" title="type serde_core::ser::SerializeMap::Error">Error</a>&gt;<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a>,</div></h4></section></summary><div class="docblock"><p>Serialize a map key.</p>
<p>If possible, <code>Serialize</code> implementations are encouraged to use
<code>serialize_entry</code> instead as it may be implemented more efficiently in
some formats compared to a pair of calls to <code>serialize_key</code> and
<code>serialize_value</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_value" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1834-1836">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_value" class="fn">serialize_value</a>&lt;T&gt;(&amp;mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Error" title="type serde_core::ser::SerializeMap::Error">Error</a>&gt;<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a>,</div></h4></section></summary><div class="docblock"><p>Serialize a map value.</p>
<h5 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h5>
<p>Calling <code>serialize_value</code> before <code>serialize_key</code> is incorrect and is
allowed to panic or produce bogus results.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.end" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1865">Source</a><h4 class="code-header">fn <a href="#tymethod.end" class="fn">end</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Ok" title="type serde_core::ser::SerializeMap::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Error" title="type serde_core::ser::SerializeMap::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Finish serializing a map.</p>
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.serialize_entry" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1855-1862">Source</a><h4 class="code-header">fn <a href="#method.serialize_entry" class="fn">serialize_entry</a>&lt;K, V&gt;(
&amp;mut self,
key: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;K</a>,
value: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;V</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Error" title="type serde_core::ser::SerializeMap::Error">Error</a>&gt;<div class="where">where
K: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a>,
V: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a>,</div></h4></section></summary><div class="docblock"><p>Serialize a map entry consisting of a key and a value.</p>
<p>Some <a href="../trait.Serialize.html" title="trait serde_core::Serialize"><code>Serialize</code></a> types are not able to hold a key and value in memory
at the same time so <code>SerializeMap</code> implementations are required to
support <a href="trait.SerializeMap.html#tymethod.serialize_key"><code>serialize_key</code></a> and <a href="trait.SerializeMap.html#tymethod.serialize_value"><code>serialize_value</code></a> individually. The
<code>serialize_entry</code> method allows serializers to optimize for the case
where key and value are both available. <a href="../trait.Serialize.html" title="trait serde_core::Serialize"><code>Serialize</code></a> implementations
are encouraged to use <code>serialize_entry</code> if possible.</p>
<p>The default implementation delegates to <a href="trait.SerializeMap.html#tymethod.serialize_key"><code>serialize_key</code></a> and
<a href="trait.SerializeMap.html#tymethod.serialize_value"><code>serialize_value</code></a>. This is appropriate for serializers that do not
care about performance or are not able to optimize <code>serialize_entry</code> any
better than this.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-SerializeMap-for-Impossible%3COk,+Error%3E" class="impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#148-174">Source</a><a href="#impl-SerializeMap-for-Impossible%3COk,+Error%3E" class="anchor">§</a><h3 class="code-header">impl&lt;Ok, Error&gt; <a class="trait" href="trait.SerializeMap.html" title="trait serde_core::ser::SerializeMap">SerializeMap</a> for <a class="struct" href="struct.Impossible.html" title="struct serde_core::ser::Impossible">Impossible</a>&lt;Ok, Error&gt;<div class="where">where
Error: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Ok-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#152">Source</a><a href="#associatedtype.Ok-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Ok" class="associatedtype">Ok</a> = Ok</h4></section><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#153">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = Error</h4></section></div></details></div><script src="../../trait.impl/serde_core/ser/trait.SerializeMap.js" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,36 @@
<!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="Returned from `Serializer::serialize_seq`."><title>SerializeSeq in serde_core::ser - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">SerializeSeq</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Serialize<wbr>Seq</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example-use" title="Example use">Example use</a></li><li><a href="#example-implementation" title="Example implementation">Example implementation</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Error" title="Error">Error</a></li><li><a href="#associatedtype.Ok" title="Ok">Ok</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.end" title="end">end</a></li><li><a href="#tymethod.serialize_element" title="serialize_element">serialize_element</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In serde_<wbr>core::<wbr>ser</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">serde_core</a>::<wbr><a href="index.html">ser</a></div><h1>Trait <span class="trait">Serialize<wbr>Seq</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/serde_core/ser/mod.rs.html#1518-1532">Source</a> </span></div><pre class="rust item-decl"><code>pub trait SerializeSeq {
type <a href="#associatedtype.Ok" class="associatedtype">Ok</a>;
type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a>;
// Required methods
fn <a href="#tymethod.serialize_element" class="fn">serialize_element</a>&lt;T&gt;(&amp;mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeSeq.html#associatedtype.Error" title="type serde_core::ser::SerializeSeq::Error">Error</a>&gt;
<span class="where">where T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a></span>;
<span class="item-spacer"></span> fn <a href="#tymethod.end" class="fn">end</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.SerializeSeq.html#associatedtype.Ok" title="type serde_core::ser::SerializeSeq::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeSeq.html#associatedtype.Error" title="type serde_core::ser::SerializeSeq::Error">Error</a>&gt;;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returned from <code>Serializer::serialize_seq</code>.</p>
<h2 id="example-use"><a class="doc-anchor" href="#example-use">§</a>Example use</h2>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>serde::ser::{Serialize, SerializeSeq, Serializer};
<span class="kw">impl</span>&lt;T&gt; Serialize <span class="kw">for </span>Vec&lt;T&gt;
<span class="kw">where
</span>T: Serialize,
{
<span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
<span class="kw">where
</span>S: Serializer,
{
<span class="kw">let </span><span class="kw-2">mut </span>seq = serializer.serialize_seq(<span class="prelude-val">Some</span>(<span class="self">self</span>.len()))<span class="question-mark">?</span>;
<span class="kw">for </span>element <span class="kw">in </span><span class="self">self </span>{
seq.serialize_element(element)<span class="question-mark">?</span>;
}
seq.end()
}
}</code></pre></div><h2 id="example-implementation"><a class="doc-anchor" href="#example-implementation">§</a>Example implementation</h2>
<p>The <a href="https://serde.rs/data-format.html">example data format</a> presented on the website demonstrates an
implementation of <code>SerializeSeq</code> for a basic JSON data format.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Ok" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1520">Source</a><h4 class="code-header">type <a href="#associatedtype.Ok" class="associatedtype">Ok</a></h4></section></summary><div class="docblock"><p>Must match the <code>Ok</code> type of our <code>Serializer</code>.</p>
</div></details><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1523">Source</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a></h4></section></summary><div class="docblock"><p>Must match the <code>Error</code> type of our <code>Serializer</code>.</p>
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_element" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1526-1528">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_element" class="fn">serialize_element</a>&lt;T&gt;(&amp;mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeSeq.html#associatedtype.Error" title="type serde_core::ser::SerializeSeq::Error">Error</a>&gt;<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a>,</div></h4></section></summary><div class="docblock"><p>Serialize a sequence element.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.end" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1531">Source</a><h4 class="code-header">fn <a href="#tymethod.end" class="fn">end</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.SerializeSeq.html#associatedtype.Ok" title="type serde_core::ser::SerializeSeq::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeSeq.html#associatedtype.Error" title="type serde_core::ser::SerializeSeq::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Finish serializing a sequence.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-SerializeSeq-for-Impossible%3COk,+Error%3E" class="impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#68-86">Source</a><a href="#impl-SerializeSeq-for-Impossible%3COk,+Error%3E" class="anchor">§</a><h3 class="code-header">impl&lt;Ok, Error&gt; <a class="trait" href="trait.SerializeSeq.html" title="trait serde_core::ser::SerializeSeq">SerializeSeq</a> for <a class="struct" href="struct.Impossible.html" title="struct serde_core::ser::Impossible">Impossible</a>&lt;Ok, Error&gt;<div class="where">where
Error: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Ok-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#72">Source</a><a href="#associatedtype.Ok-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Ok" class="associatedtype">Ok</a> = Ok</h4></section><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#73">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = Error</h4></section></div></details></div><script src="../../trait.impl/serde_core/ser/trait.SerializeSeq.js" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,52 @@
<!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="Returned from `Serializer::serialize_struct`."><title>SerializeStruct in serde_core::ser - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">SerializeStruct</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Serialize<wbr>Struct</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example-use" title="Example use">Example use</a></li><li><a href="#example-implementation" title="Example implementation">Example implementation</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Error" title="Error">Error</a></li><li><a href="#associatedtype.Ok" title="Ok">Ok</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.end" title="end">end</a></li><li><a href="#tymethod.serialize_field" title="serialize_field">serialize_field</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.skip_field" title="skip_field">skip_field</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In serde_<wbr>core::<wbr>ser</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">serde_core</a>::<wbr><a href="index.html">ser</a></div><h1>Trait <span class="trait">Serialize<wbr>Struct</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/serde_core/ser/mod.rs.html#1907-1930">Source</a> </span></div><pre class="rust item-decl"><code>pub trait SerializeStruct {
type <a href="#associatedtype.Ok" class="associatedtype">Ok</a>;
type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a>;
// Required methods
fn <a href="#tymethod.serialize_field" class="fn">serialize_field</a>&lt;T&gt;(
&amp;mut self,
key: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>,
value: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeStruct.html#associatedtype.Error" title="type serde_core::ser::SerializeStruct::Error">Error</a>&gt;
<span class="where">where T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a></span>;
<span class="item-spacer"></span> fn <a href="#tymethod.end" class="fn">end</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.SerializeStruct.html#associatedtype.Ok" title="type serde_core::ser::SerializeStruct::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeStruct.html#associatedtype.Error" title="type serde_core::ser::SerializeStruct::Error">Error</a>&gt;;
// Provided method
fn <a href="#method.skip_field" class="fn">skip_field</a>(&amp;mut self, key: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeStruct.html#associatedtype.Error" title="type serde_core::ser::SerializeStruct::Error">Error</a>&gt; { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returned from <code>Serializer::serialize_struct</code>.</p>
<h2 id="example-use"><a class="doc-anchor" href="#example-use">§</a>Example use</h2>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>serde::ser::{Serialize, SerializeStruct, Serializer};
<span class="kw">struct </span>Rgb {
r: u8,
g: u8,
b: u8,
}
<span class="kw">impl </span>Serialize <span class="kw">for </span>Rgb {
<span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
<span class="kw">where
</span>S: Serializer,
{
<span class="kw">let </span><span class="kw-2">mut </span>rgb = serializer.serialize_struct(<span class="string">"Rgb"</span>, <span class="number">3</span>)<span class="question-mark">?</span>;
rgb.serialize_field(<span class="string">"r"</span>, <span class="kw-2">&amp;</span><span class="self">self</span>.r)<span class="question-mark">?</span>;
rgb.serialize_field(<span class="string">"g"</span>, <span class="kw-2">&amp;</span><span class="self">self</span>.g)<span class="question-mark">?</span>;
rgb.serialize_field(<span class="string">"b"</span>, <span class="kw-2">&amp;</span><span class="self">self</span>.b)<span class="question-mark">?</span>;
rgb.end()
}
}</code></pre></div><h2 id="example-implementation"><a class="doc-anchor" href="#example-implementation">§</a>Example implementation</h2>
<p>The <a href="https://serde.rs/data-format.html">example data format</a> presented on the website demonstrates an
implementation of <code>SerializeStruct</code> for a basic JSON data format.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Ok" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1909">Source</a><h4 class="code-header">type <a href="#associatedtype.Ok" class="associatedtype">Ok</a></h4></section></summary><div class="docblock"><p>Must match the <code>Ok</code> type of our <code>Serializer</code>.</p>
</div></details><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1912">Source</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a></h4></section></summary><div class="docblock"><p>Must match the <code>Error</code> type of our <code>Serializer</code>.</p>
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_field" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1915-1917">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_field" class="fn">serialize_field</a>&lt;T&gt;(
&amp;mut self,
key: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>,
value: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeStruct.html#associatedtype.Error" title="type serde_core::ser::SerializeStruct::Error">Error</a>&gt;<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a>,</div></h4></section></summary><div class="docblock"><p>Serialize a struct field.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.end" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1929">Source</a><h4 class="code-header">fn <a href="#tymethod.end" class="fn">end</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.SerializeStruct.html#associatedtype.Ok" title="type serde_core::ser::SerializeStruct::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeStruct.html#associatedtype.Error" title="type serde_core::ser::SerializeStruct::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Finish serializing a struct.</p>
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.skip_field" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1923-1926">Source</a><h4 class="code-header">fn <a href="#method.skip_field" class="fn">skip_field</a>(&amp;mut self, key: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeStruct.html#associatedtype.Error" title="type serde_core::ser::SerializeStruct::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Indicate that a struct field has been skipped.</p>
<p>The default implementation does nothing.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-SerializeStruct-for-Impossible%3COk,+Error%3E" class="impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#176-195">Source</a><a href="#impl-SerializeStruct-for-Impossible%3COk,+Error%3E" class="anchor">§</a><h3 class="code-header">impl&lt;Ok, Error&gt; <a class="trait" href="trait.SerializeStruct.html" title="trait serde_core::ser::SerializeStruct">SerializeStruct</a> for <a class="struct" href="struct.Impossible.html" title="struct serde_core::ser::Impossible">Impossible</a>&lt;Ok, Error&gt;<div class="where">where
Error: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Ok-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#180">Source</a><a href="#associatedtype.Ok-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Ok" class="associatedtype">Ok</a> = Ok</h4></section><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#181">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = Error</h4></section></div></details></div><script src="../../trait.impl/serde_core/ser/trait.SerializeStruct.js" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,58 @@
<!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="Returned from `Serializer::serialize_struct_variant`."><title>SerializeStructVariant in serde_core::ser - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">SerializeStructVariant</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Serialize<wbr>Struct<wbr>Variant</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example-use" title="Example use">Example use</a></li><li><a href="#example-implementation" title="Example implementation">Example implementation</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Error" title="Error">Error</a></li><li><a href="#associatedtype.Ok" title="Ok">Ok</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.end" title="end">end</a></li><li><a href="#tymethod.serialize_field" title="serialize_field">serialize_field</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.skip_field" title="skip_field">skip_field</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In serde_<wbr>core::<wbr>ser</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">serde_core</a>::<wbr><a href="index.html">ser</a></div><h1>Trait <span class="trait">Serialize<wbr>Struct<wbr>Variant</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/serde_core/ser/mod.rs.html#1977-2000">Source</a> </span></div><pre class="rust item-decl"><code>pub trait SerializeStructVariant {
type <a href="#associatedtype.Ok" class="associatedtype">Ok</a>;
type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a>;
// Required methods
fn <a href="#tymethod.serialize_field" class="fn">serialize_field</a>&lt;T&gt;(
&amp;mut self,
key: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>,
value: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeStructVariant.html#associatedtype.Error" title="type serde_core::ser::SerializeStructVariant::Error">Error</a>&gt;
<span class="where">where T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a></span>;
<span class="item-spacer"></span> fn <a href="#tymethod.end" class="fn">end</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.SerializeStructVariant.html#associatedtype.Ok" title="type serde_core::ser::SerializeStructVariant::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeStructVariant.html#associatedtype.Error" title="type serde_core::ser::SerializeStructVariant::Error">Error</a>&gt;;
// Provided method
fn <a href="#method.skip_field" class="fn">skip_field</a>(&amp;mut self, key: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeStructVariant.html#associatedtype.Error" title="type serde_core::ser::SerializeStructVariant::Error">Error</a>&gt; { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returned from <code>Serializer::serialize_struct_variant</code>.</p>
<h2 id="example-use"><a class="doc-anchor" href="#example-use">§</a>Example use</h2>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>serde::ser::{Serialize, SerializeStructVariant, Serializer};
<span class="kw">enum </span>E {
S { r: u8, g: u8, b: u8 },
}
<span class="kw">impl </span>Serialize <span class="kw">for </span>E {
<span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
<span class="kw">where
</span>S: Serializer,
{
<span class="kw">match </span><span class="kw-2">*</span><span class="self">self </span>{
E::S {
<span class="kw-2">ref </span>r,
<span class="kw-2">ref </span>g,
<span class="kw-2">ref </span>b,
} =&gt; {
<span class="kw">let </span><span class="kw-2">mut </span>sv = serializer.serialize_struct_variant(<span class="string">"E"</span>, <span class="number">0</span>, <span class="string">"S"</span>, <span class="number">3</span>)<span class="question-mark">?</span>;
sv.serialize_field(<span class="string">"r"</span>, r)<span class="question-mark">?</span>;
sv.serialize_field(<span class="string">"g"</span>, g)<span class="question-mark">?</span>;
sv.serialize_field(<span class="string">"b"</span>, b)<span class="question-mark">?</span>;
sv.end()
}
}
}
}</code></pre></div><h2 id="example-implementation"><a class="doc-anchor" href="#example-implementation">§</a>Example implementation</h2>
<p>The <a href="https://serde.rs/data-format.html">example data format</a> presented on the website demonstrates an
implementation of <code>SerializeStructVariant</code> for a basic JSON data format.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Ok" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1979">Source</a><h4 class="code-header">type <a href="#associatedtype.Ok" class="associatedtype">Ok</a></h4></section></summary><div class="docblock"><p>Must match the <code>Ok</code> type of our <code>Serializer</code>.</p>
</div></details><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1982">Source</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a></h4></section></summary><div class="docblock"><p>Must match the <code>Error</code> type of our <code>Serializer</code>.</p>
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_field" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1985-1987">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_field" class="fn">serialize_field</a>&lt;T&gt;(
&amp;mut self,
key: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>,
value: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeStructVariant.html#associatedtype.Error" title="type serde_core::ser::SerializeStructVariant::Error">Error</a>&gt;<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a>,</div></h4></section></summary><div class="docblock"><p>Serialize a struct variant field.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.end" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1999">Source</a><h4 class="code-header">fn <a href="#tymethod.end" class="fn">end</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.SerializeStructVariant.html#associatedtype.Ok" title="type serde_core::ser::SerializeStructVariant::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeStructVariant.html#associatedtype.Error" title="type serde_core::ser::SerializeStructVariant::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Finish serializing a struct variant.</p>
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.skip_field" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1993-1996">Source</a><h4 class="code-header">fn <a href="#method.skip_field" class="fn">skip_field</a>(&amp;mut self, key: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeStructVariant.html#associatedtype.Error" title="type serde_core::ser::SerializeStructVariant::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Indicate that a struct variant field has been skipped.</p>
<p>The default implementation does nothing.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-SerializeStructVariant-for-Impossible%3COk,+Error%3E" class="impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#197-216">Source</a><a href="#impl-SerializeStructVariant-for-Impossible%3COk,+Error%3E" class="anchor">§</a><h3 class="code-header">impl&lt;Ok, Error&gt; <a class="trait" href="trait.SerializeStructVariant.html" title="trait serde_core::ser::SerializeStructVariant">SerializeStructVariant</a> for <a class="struct" href="struct.Impossible.html" title="struct serde_core::ser::Impossible">Impossible</a>&lt;Ok, Error&gt;<div class="where">where
Error: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Ok-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#201">Source</a><a href="#associatedtype.Ok-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Ok" class="associatedtype">Ok</a> = Ok</h4></section><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#202">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = Error</h4></section></div></details></div><script src="../../trait.impl/serde_core/ser/trait.SerializeStructVariant.js" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,55 @@
<!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="Returned from `Serializer::serialize_tuple`."><title>SerializeTuple in serde_core::ser - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">SerializeTuple</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Serialize<wbr>Tuple</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example-use" title="Example use">Example use</a></li><li><a href="#example-implementation" title="Example implementation">Example implementation</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Error" title="Error">Error</a></li><li><a href="#associatedtype.Ok" title="Ok">Ok</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.end" title="end">end</a></li><li><a href="#tymethod.serialize_element" title="serialize_element">serialize_element</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In serde_<wbr>core::<wbr>ser</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">serde_core</a>::<wbr><a href="index.html">ser</a></div><h1>Trait <span class="trait">Serialize<wbr>Tuple</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/serde_core/ser/mod.rs.html#1624-1638">Source</a> </span></div><pre class="rust item-decl"><code>pub trait SerializeTuple {
type <a href="#associatedtype.Ok" class="associatedtype">Ok</a>;
type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a>;
// Required methods
fn <a href="#tymethod.serialize_element" class="fn">serialize_element</a>&lt;T&gt;(&amp;mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeTuple.html#associatedtype.Error" title="type serde_core::ser::SerializeTuple::Error">Error</a>&gt;
<span class="where">where T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a></span>;
<span class="item-spacer"></span> fn <a href="#tymethod.end" class="fn">end</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.SerializeTuple.html#associatedtype.Ok" title="type serde_core::ser::SerializeTuple::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeTuple.html#associatedtype.Error" title="type serde_core::ser::SerializeTuple::Error">Error</a>&gt;;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returned from <code>Serializer::serialize_tuple</code>.</p>
<h2 id="example-use"><a class="doc-anchor" href="#example-use">§</a>Example use</h2>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>serde::ser::{Serialize, SerializeTuple, Serializer};
<span class="kw">impl</span>&lt;A, B, C&gt; Serialize <span class="kw">for </span>(A, B, C)
<span class="kw">where
</span>A: Serialize,
B: Serialize,
C: Serialize,
{
<span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
<span class="kw">where
</span>S: Serializer,
{
<span class="kw">let </span><span class="kw-2">mut </span>tup = serializer.serialize_tuple(<span class="number">3</span>)<span class="question-mark">?</span>;
tup.serialize_element(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">0</span>)<span class="question-mark">?</span>;
tup.serialize_element(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">1</span>)<span class="question-mark">?</span>;
tup.serialize_element(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">2</span>)<span class="question-mark">?</span>;
tup.end()
}
}</code></pre></div>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>serde::ser::{Serialize, SerializeTuple, Serializer};
<span class="kw">impl</span>&lt;T&gt; Serialize <span class="kw">for </span>[T; <span class="number">16</span>]
<span class="kw">where
</span>T: Serialize,
{
<span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
<span class="kw">where
</span>S: Serializer,
{
<span class="kw">let </span><span class="kw-2">mut </span>seq = serializer.serialize_tuple(<span class="number">16</span>)<span class="question-mark">?</span>;
<span class="kw">for </span>element <span class="kw">in </span><span class="self">self </span>{
seq.serialize_element(element)<span class="question-mark">?</span>;
}
seq.end()
}
}</code></pre></div><h2 id="example-implementation"><a class="doc-anchor" href="#example-implementation">§</a>Example implementation</h2>
<p>The <a href="https://serde.rs/data-format.html">example data format</a> presented on the website demonstrates an
implementation of <code>SerializeTuple</code> for a basic JSON data format.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Ok" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1626">Source</a><h4 class="code-header">type <a href="#associatedtype.Ok" class="associatedtype">Ok</a></h4></section></summary><div class="docblock"><p>Must match the <code>Ok</code> type of our <code>Serializer</code>.</p>
</div></details><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1629">Source</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a></h4></section></summary><div class="docblock"><p>Must match the <code>Error</code> type of our <code>Serializer</code>.</p>
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_element" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1632-1634">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_element" class="fn">serialize_element</a>&lt;T&gt;(&amp;mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeTuple.html#associatedtype.Error" title="type serde_core::ser::SerializeTuple::Error">Error</a>&gt;<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a>,</div></h4></section></summary><div class="docblock"><p>Serialize a tuple element.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.end" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1637">Source</a><h4 class="code-header">fn <a href="#tymethod.end" class="fn">end</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.SerializeTuple.html#associatedtype.Ok" title="type serde_core::ser::SerializeTuple::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeTuple.html#associatedtype.Error" title="type serde_core::ser::SerializeTuple::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Finish serializing a tuple.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-SerializeTuple-for-Impossible%3COk,+Error%3E" class="impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#88-106">Source</a><a href="#impl-SerializeTuple-for-Impossible%3COk,+Error%3E" class="anchor">§</a><h3 class="code-header">impl&lt;Ok, Error&gt; <a class="trait" href="trait.SerializeTuple.html" title="trait serde_core::ser::SerializeTuple">SerializeTuple</a> for <a class="struct" href="struct.Impossible.html" title="struct serde_core::ser::Impossible">Impossible</a>&lt;Ok, Error&gt;<div class="where">where
Error: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Ok-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#92">Source</a><a href="#associatedtype.Ok-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Ok" class="associatedtype">Ok</a> = Ok</h4></section><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#93">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = Error</h4></section></div></details></div><script src="../../trait.impl/serde_core/ser/trait.SerializeTuple.js" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,35 @@
<!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="Returned from `Serializer::serialize_tuple_struct`."><title>SerializeTupleStruct in serde_core::ser - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">SerializeTupleStruct</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Serialize<wbr>Tuple<wbr>Struct</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example-use" title="Example use">Example use</a></li><li><a href="#example-implementation" title="Example implementation">Example implementation</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Error" title="Error">Error</a></li><li><a href="#associatedtype.Ok" title="Ok">Ok</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.end" title="end">end</a></li><li><a href="#tymethod.serialize_field" title="serialize_field">serialize_field</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In serde_<wbr>core::<wbr>ser</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">serde_core</a>::<wbr><a href="index.html">ser</a></div><h1>Trait <span class="trait">Serialize<wbr>Tuple<wbr>Struct</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/serde_core/ser/mod.rs.html#1675-1689">Source</a> </span></div><pre class="rust item-decl"><code>pub trait SerializeTupleStruct {
type <a href="#associatedtype.Ok" class="associatedtype">Ok</a>;
type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a>;
// Required methods
fn <a href="#tymethod.serialize_field" class="fn">serialize_field</a>&lt;T&gt;(&amp;mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeTupleStruct.html#associatedtype.Error" title="type serde_core::ser::SerializeTupleStruct::Error">Error</a>&gt;
<span class="where">where T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a></span>;
<span class="item-spacer"></span> fn <a href="#tymethod.end" class="fn">end</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.SerializeTupleStruct.html#associatedtype.Ok" title="type serde_core::ser::SerializeTupleStruct::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeTupleStruct.html#associatedtype.Error" title="type serde_core::ser::SerializeTupleStruct::Error">Error</a>&gt;;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returned from <code>Serializer::serialize_tuple_struct</code>.</p>
<h2 id="example-use"><a class="doc-anchor" href="#example-use">§</a>Example use</h2>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>serde::ser::{Serialize, SerializeTupleStruct, Serializer};
<span class="kw">struct </span>Rgb(u8, u8, u8);
<span class="kw">impl </span>Serialize <span class="kw">for </span>Rgb {
<span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
<span class="kw">where
</span>S: Serializer,
{
<span class="kw">let </span><span class="kw-2">mut </span>ts = serializer.serialize_tuple_struct(<span class="string">"Rgb"</span>, <span class="number">3</span>)<span class="question-mark">?</span>;
ts.serialize_field(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">0</span>)<span class="question-mark">?</span>;
ts.serialize_field(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">1</span>)<span class="question-mark">?</span>;
ts.serialize_field(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">2</span>)<span class="question-mark">?</span>;
ts.end()
}
}</code></pre></div><h2 id="example-implementation"><a class="doc-anchor" href="#example-implementation">§</a>Example implementation</h2>
<p>The <a href="https://serde.rs/data-format.html">example data format</a> presented on the website demonstrates an
implementation of <code>SerializeTupleStruct</code> for a basic JSON data format.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Ok" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1677">Source</a><h4 class="code-header">type <a href="#associatedtype.Ok" class="associatedtype">Ok</a></h4></section></summary><div class="docblock"><p>Must match the <code>Ok</code> type of our <code>Serializer</code>.</p>
</div></details><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1680">Source</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a></h4></section></summary><div class="docblock"><p>Must match the <code>Error</code> type of our <code>Serializer</code>.</p>
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_field" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1683-1685">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_field" class="fn">serialize_field</a>&lt;T&gt;(&amp;mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeTupleStruct.html#associatedtype.Error" title="type serde_core::ser::SerializeTupleStruct::Error">Error</a>&gt;<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a>,</div></h4></section></summary><div class="docblock"><p>Serialize a tuple struct field.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.end" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1688">Source</a><h4 class="code-header">fn <a href="#tymethod.end" class="fn">end</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.SerializeTupleStruct.html#associatedtype.Ok" title="type serde_core::ser::SerializeTupleStruct::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeTupleStruct.html#associatedtype.Error" title="type serde_core::ser::SerializeTupleStruct::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Finish serializing a tuple struct.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-SerializeTupleStruct-for-Impossible%3COk,+Error%3E" class="impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#108-126">Source</a><a href="#impl-SerializeTupleStruct-for-Impossible%3COk,+Error%3E" class="anchor">§</a><h3 class="code-header">impl&lt;Ok, Error&gt; <a class="trait" href="trait.SerializeTupleStruct.html" title="trait serde_core::ser::SerializeTupleStruct">SerializeTupleStruct</a> for <a class="struct" href="struct.Impossible.html" title="struct serde_core::ser::Impossible">Impossible</a>&lt;Ok, Error&gt;<div class="where">where
Error: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Ok-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#112">Source</a><a href="#associatedtype.Ok-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Ok" class="associatedtype">Ok</a> = Ok</h4></section><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#113">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = Error</h4></section></div></details></div><script src="../../trait.impl/serde_core/ser/trait.SerializeTupleStruct.js" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,48 @@
<!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="Returned from `Serializer::serialize_tuple_variant`."><title>SerializeTupleVariant in serde_core::ser - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">SerializeTupleVariant</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde_core/index.html">serde_<wbr>core</a><span class="version">1.0.228</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Serialize<wbr>Tuple<wbr>Variant</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example-use" title="Example use">Example use</a></li><li><a href="#example-implementation" title="Example implementation">Example implementation</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Error" title="Error">Error</a></li><li><a href="#associatedtype.Ok" title="Ok">Ok</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.end" title="end">end</a></li><li><a href="#tymethod.serialize_field" title="serialize_field">serialize_field</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In serde_<wbr>core::<wbr>ser</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">serde_core</a>::<wbr><a href="index.html">ser</a></div><h1>Trait <span class="trait">Serialize<wbr>Tuple<wbr>Variant</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/serde_core/ser/mod.rs.html#1739-1753">Source</a> </span></div><pre class="rust item-decl"><code>pub trait SerializeTupleVariant {
type <a href="#associatedtype.Ok" class="associatedtype">Ok</a>;
type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a>;
// Required methods
fn <a href="#tymethod.serialize_field" class="fn">serialize_field</a>&lt;T&gt;(&amp;mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeTupleVariant.html#associatedtype.Error" title="type serde_core::ser::SerializeTupleVariant::Error">Error</a>&gt;
<span class="where">where T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a></span>;
<span class="item-spacer"></span> fn <a href="#tymethod.end" class="fn">end</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.SerializeTupleVariant.html#associatedtype.Ok" title="type serde_core::ser::SerializeTupleVariant::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeTupleVariant.html#associatedtype.Error" title="type serde_core::ser::SerializeTupleVariant::Error">Error</a>&gt;;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returned from <code>Serializer::serialize_tuple_variant</code>.</p>
<h2 id="example-use"><a class="doc-anchor" href="#example-use">§</a>Example use</h2>
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021"></a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>serde::ser::{Serialize, SerializeTupleVariant, Serializer};
<span class="kw">enum </span>E {
T(u8, u8),
U(String, u32, u32),
}
<span class="kw">impl </span>Serialize <span class="kw">for </span>E {
<span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
<span class="kw">where
</span>S: Serializer,
{
<span class="kw">match </span><span class="kw-2">*</span><span class="self">self </span>{
E::T(<span class="kw-2">ref </span>a, <span class="kw-2">ref </span>b) =&gt; {
<span class="kw">let </span><span class="kw-2">mut </span>tv = serializer.serialize_tuple_variant(<span class="string">"E"</span>, <span class="number">0</span>, <span class="string">"T"</span>, <span class="number">2</span>)<span class="question-mark">?</span>;
tv.serialize_field(a)<span class="question-mark">?</span>;
tv.serialize_field(b)<span class="question-mark">?</span>;
tv.end()
}
E::U(<span class="kw-2">ref </span>a, <span class="kw-2">ref </span>b, <span class="kw-2">ref </span>c) =&gt; {
<span class="kw">let </span><span class="kw-2">mut </span>tv = serializer.serialize_tuple_variant(<span class="string">"E"</span>, <span class="number">1</span>, <span class="string">"U"</span>, <span class="number">3</span>)<span class="question-mark">?</span>;
tv.serialize_field(a)<span class="question-mark">?</span>;
tv.serialize_field(b)<span class="question-mark">?</span>;
tv.serialize_field(c)<span class="question-mark">?</span>;
tv.end()
}
}
}
}</code></pre></div><h2 id="example-implementation"><a class="doc-anchor" href="#example-implementation">§</a>Example implementation</h2>
<p>The <a href="https://serde.rs/data-format.html">example data format</a> presented on the website demonstrates an
implementation of <code>SerializeTupleVariant</code> for a basic JSON data format.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Ok" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1741">Source</a><h4 class="code-header">type <a href="#associatedtype.Ok" class="associatedtype">Ok</a></h4></section></summary><div class="docblock"><p>Must match the <code>Ok</code> type of our <code>Serializer</code>.</p>
</div></details><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1744">Source</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a></h4></section></summary><div class="docblock"><p>Must match the <code>Error</code> type of our <code>Serializer</code>.</p>
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_field" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1747-1749">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_field" class="fn">serialize_field</a>&lt;T&gt;(&amp;mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeTupleVariant.html#associatedtype.Error" title="type serde_core::ser::SerializeTupleVariant::Error">Error</a>&gt;<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde_core::Serialize">Serialize</a>,</div></h4></section></summary><div class="docblock"><p>Serialize a tuple variant field.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.end" class="method"><a class="src rightside" href="../../src/serde_core/ser/mod.rs.html#1752">Source</a><h4 class="code-header">fn <a href="#tymethod.end" class="fn">end</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.SerializeTupleVariant.html#associatedtype.Ok" title="type serde_core::ser::SerializeTupleVariant::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeTupleVariant.html#associatedtype.Error" title="type serde_core::ser::SerializeTupleVariant::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Finish serializing a tuple variant.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-SerializeTupleVariant-for-Impossible%3COk,+Error%3E" class="impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#128-146">Source</a><a href="#impl-SerializeTupleVariant-for-Impossible%3COk,+Error%3E" class="anchor">§</a><h3 class="code-header">impl&lt;Ok, Error&gt; <a class="trait" href="trait.SerializeTupleVariant.html" title="trait serde_core::ser::SerializeTupleVariant">SerializeTupleVariant</a> for <a class="struct" href="struct.Impossible.html" title="struct serde_core::ser::Impossible">Impossible</a>&lt;Ok, Error&gt;<div class="where">where
Error: <a class="trait" href="trait.Error.html" title="trait serde_core::ser::Error">Error</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Ok-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#132">Source</a><a href="#associatedtype.Ok-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Ok" class="associatedtype">Ok</a> = Ok</h4></section><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde_core/ser/impossible.rs.html#133">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = Error</h4></section></div></details></div><script src="../../trait.impl/serde_core/ser/trait.SerializeTupleVariant.js" async></script></section></div></main></body></html>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"macro":["forward_to_deserialize_any"],"mod":["de","ser"],"trait":["Deserialize","Deserializer","Serialize","Serializer"]};

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