mirror of
https://github.com/NotAShelf/mpvrc.git
synced 2026-04-17 16:29:50 +00:00
deploy: de38ae62916547ad097c066f94a32e9ba7790eeb
This commit is contained in:
commit
9a86359447
28502 changed files with 1261284 additions and 0 deletions
1
serde/all.html
Normal file
1
serde/all.html
Normal file
File diff suppressed because one or more lines are too long
69
serde/de/enum.Unexpected.html
Normal file
69
serde/de/enum.Unexpected.html
Normal file
File diff suppressed because one or more lines are too long
11
serde/de/ignored_any/struct.IgnoredAny.html
Normal file
11
serde/de/ignored_any/struct.IgnoredAny.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../serde/de/struct.IgnoredAny.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../serde/de/struct.IgnoredAny.html">../../../serde/de/struct.IgnoredAny.html</a>...</p>
|
||||
<script>location.replace("../../../serde/de/struct.IgnoredAny.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
133
serde/de/index.html
Normal file
133
serde/de/index.html
Normal 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::de - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde/index.html">serde</a><span class="version">1.0.216</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</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">serde</a></span><h1>Module <span>de</span><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/de/mod.rs.html#1-2335">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"><code>Deserialize</code></a> and
|
||||
<a href="../trait.Deserializer.html"><code>Deserializer</code></a>.</p>
|
||||
<ul>
|
||||
<li><strong>A type that implements <code>Deserialize</code> is a data structure</strong> that can be
|
||||
deserialized from any data format supported by Serde, and conversely</li>
|
||||
<li><strong>A type that implements <code>Deserializer</code> is a data format</strong> that can
|
||||
deserialize any data structure supported by Serde.</li>
|
||||
</ul>
|
||||
<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"><code>Deserialize</code></a> implementations for many Rust primitive and
|
||||
standard library types. The complete list is below. All of these can be
|
||||
deserialized using Serde out of the box.</p>
|
||||
<p>Additionally, Serde provides a procedural macro called <a href="https://crates.io/crates/serde_derive"><code>serde_derive</code></a> to
|
||||
automatically generate <a href="../trait.Deserialize.html"><code>Deserialize</code></a> implementations for structs and enums
|
||||
in your program. See the <a href="https://serde.rs/derive.html">derive section of the manual</a> for how to use this.</p>
|
||||
<p>In rare cases it may be necessary to implement <a href="../trait.Deserialize.html"><code>Deserialize</code></a> manually for
|
||||
some type in your program. See the <a href="https://serde.rs/impl-deserialize.html">Implementing <code>Deserialize</code></a> section of
|
||||
the manual for more about this.</p>
|
||||
<p>Third-party crates may provide <a href="../trait.Deserialize.html"><code>Deserialize</code></a> implementations for types
|
||||
that they expose. For example the <a href="https://crates.io/crates/linked-hash-map"><code>linked-hash-map</code></a> crate provides a
|
||||
<a href="https://docs.rs/linked-hash-map/*/linked_hash_map/struct.LinkedHashMap.html"><code>LinkedHashMap<K, V></code></a> type that is deserializable by Serde because the
|
||||
crate provides an implementation of <a href="../trait.Deserialize.html"><code>Deserialize</code></a> for it.</p>
|
||||
<h2 id="the-deserializer-trait"><a class="doc-anchor" href="#the-deserializer-trait">§</a>The Deserializer trait</h2>
|
||||
<p><a href="../trait.Deserializer.html"><code>Deserializer</code></a> implementations are provided by third-party crates, for
|
||||
example <a href="https://github.com/serde-rs/json"><code>serde_json</code></a>, <a href="https://github.com/dtolnay/serde-yaml"><code>serde_yaml</code></a> and <a href="https://github.com/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<T></li>
|
||||
<li>Result<T, E></li>
|
||||
<li>PhantomData<T></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Wrapper types</strong>:
|
||||
<ul>
|
||||
<li>Box<T></li>
|
||||
<li>Box<[T]></li>
|
||||
<li>Box<str></li>
|
||||
<li>Cow<’a, T></li>
|
||||
<li>Cell<T></li>
|
||||
<li>RefCell<T></li>
|
||||
<li>Mutex<T></li>
|
||||
<li>RwLock<T></li>
|
||||
<li>Rc<T> <em>(if</em> features = [“rc”] <em>is enabled)</em></li>
|
||||
<li>Arc<T> <em>(if</em> features = [“rc”] <em>is enabled)</em></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Collection types</strong>:
|
||||
<ul>
|
||||
<li>BTreeMap<K, V></li>
|
||||
<li>BTreeSet<T></li>
|
||||
<li>BinaryHeap<T></li>
|
||||
<li>HashMap<K, V, H></li>
|
||||
<li>HashSet<T, H></li>
|
||||
<li>LinkedList<T></li>
|
||||
<li>VecDeque<T></li>
|
||||
<li>Vec<T></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Zero-copy types</strong>:
|
||||
<ul>
|
||||
<li>&str</li>
|
||||
<li>&[u8]</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>FFI types</strong>:
|
||||
<ul>
|
||||
<li>CString</li>
|
||||
<li>Box<CStr></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<T></li>
|
||||
<li>RangeInclusive<T></li>
|
||||
<li>Bound<T></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><ul class="item-table"><li><div class="item-name" id="reexport.StdError"><code>pub use std::error::<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/error/trait.Error.html" title="trait core::error::Error">Error</a> as StdError;</code></div></li></ul><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="value/index.html" title="mod serde::de::value">value</a></div><div class="desc docblock-short">Building blocks for deserializing basic values using the <code>IntoDeserializer</code>
|
||||
trait.</div></li></ul><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.IgnoredAny.html" title="struct serde::de::IgnoredAny">Ignored<wbr>Any</a></div><div class="desc docblock-short">An efficient way of discarding data from a deserializer.</div></li></ul><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="enum" href="enum.Unexpected.html" title="enum serde::de::Unexpected">Unexpected</a></div><div class="desc docblock-short"><code>Unexpected</code> represents an unexpected invocation of any one of the <code>Visitor</code>
|
||||
trait methods.</div></li></ul><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.Deserialize.html" title="trait serde::de::Deserialize">Deserialize</a></div><div class="desc docblock-short">A <strong>data structure</strong> that can be deserialized from any data format supported
|
||||
by Serde.</div></li><li><div class="item-name"><a class="trait" href="trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">Deserialize<wbr>Owned</a></div><div class="desc docblock-short">A data structure that can be deserialized without borrowing any data from
|
||||
the deserializer.</div></li><li><div class="item-name"><a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">Deserialize<wbr>Seed</a></div><div class="desc docblock-short"><code>DeserializeSeed</code> is the stateful form of the <code>Deserialize</code> trait. If you
|
||||
ever find yourself looking for a way to pass data into a <code>Deserialize</code> impl,
|
||||
this trait is the way to do it.</div></li><li><div class="item-name"><a class="trait" href="trait.Deserializer.html" title="trait serde::de::Deserializer">Deserializer</a></div><div class="desc docblock-short">A <strong>data format</strong> that can deserialize any data structure supported by
|
||||
Serde.</div></li><li><div class="item-name"><a class="trait" href="trait.EnumAccess.html" title="trait serde::de::EnumAccess">Enum<wbr>Access</a></div><div class="desc docblock-short">Provides a <code>Visitor</code> access to the data of an enum in the input.</div></li><li><div class="item-name"><a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a></div><div class="desc docblock-short">The <code>Error</code> trait allows <code>Deserialize</code> implementations to create descriptive
|
||||
error messages belonging to the <code>Deserializer</code> against which they are
|
||||
currently running.</div></li><li><div class="item-name"><a class="trait" href="trait.Expected.html" title="trait serde::de::Expected">Expected</a></div><div class="desc docblock-short"><code>Expected</code> represents an explanation of what data a <code>Visitor</code> was expecting
|
||||
to receive.</div></li><li><div class="item-name"><a class="trait" href="trait.IntoDeserializer.html" title="trait serde::de::IntoDeserializer">Into<wbr>Deserializer</a></div><div class="desc docblock-short">Converts an existing value into a <code>Deserializer</code> from which other values can
|
||||
be deserialized.</div></li><li><div class="item-name"><a class="trait" href="trait.MapAccess.html" title="trait serde::de::MapAccess">MapAccess</a></div><div class="desc docblock-short">Provides a <code>Visitor</code> access to each entry of a map in the input.</div></li><li><div class="item-name"><a class="trait" href="trait.SeqAccess.html" title="trait serde::de::SeqAccess">SeqAccess</a></div><div class="desc docblock-short">Provides a <code>Visitor</code> access to each element of a sequence in the input.</div></li><li><div class="item-name"><a class="trait" href="trait.VariantAccess.html" title="trait serde::de::VariantAccess">Variant<wbr>Access</a></div><div class="desc docblock-short"><code>VariantAccess</code> is a visitor that is created by the <code>Deserializer</code> and
|
||||
passed to the <code>Deserialize</code> to deserialize the content of a particular enum
|
||||
variant.</div></li><li><div class="item-name"><a class="trait" href="trait.Visitor.html" title="trait serde::de::Visitor">Visitor</a></div><div class="desc docblock-short">This trait represents a visitor that walks through a deserializer.</div></li></ul></section></div></main></body></html>
|
||||
1
serde/de/sidebar-items.js
Normal file
1
serde/de/sidebar-items.js
Normal 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"]};
|
||||
140
serde/de/struct.IgnoredAny.html
Normal file
140
serde/de/struct.IgnoredAny.html
Normal file
File diff suppressed because one or more lines are too long
389
serde/de/trait.Deserialize.html
Normal file
389
serde/de/trait.Deserialize.html
Normal file
File diff suppressed because one or more lines are too long
21
serde/de/trait.DeserializeOwned.html
Normal file
21
serde/de/trait.DeserializeOwned.html
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<!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::de - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde/index.html">serde</a><span class="version">1.0.216</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>de</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">serde</a>::<wbr><a href="index.html">de</a></span><h1>Trait <span class="trait">DeserializeOwned</span><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/de/mod.rs.html#613">Source</a> </span></div><pre class="rust item-decl"><code>pub trait DeserializeOwned: for<'de> <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de> { }</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<<span class="lifetime">'a</span>, T>(s: <span class="kw-2">&</span><span class="lifetime">'a </span>str) -> <span class="prelude-ty">Result</span><T>
|
||||
<span class="kw">where
|
||||
</span>T: Deserialize<<span class="lifetime">'a</span>>;
|
||||
|
||||
<span class="kw">fn </span>from_reader<R, T>(rdr: R) -> <span class="prelude-ty">Result</span><T>
|
||||
<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.84.1/reference/items/traits.html#object-safety">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/de/mod.rs.html#614">Source</a><a href="#impl-DeserializeOwned-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a> for T<div class="where">where
|
||||
T: for<'de> <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de>,</div></h3></section></div><script src="../../trait.impl/serde/de/trait.DeserializeOwned.js" async></script></section></div></main></body></html>
|
||||
138
serde/de/trait.DeserializeSeed.html
Normal file
138
serde/de/trait.DeserializeSeed.html
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
<!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::de - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde/index.html">serde</a><span class="version">1.0.216</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<T>">PhantomData<T></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>de</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">serde</a>::<wbr><a href="index.html">de</a></span><h1>Trait <span class="trait">DeserializeSeed</span><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/de/mod.rs.html#778-787">Source</a> </span></div><pre class="rust item-decl"><code>pub trait DeserializeSeed<'de>: <a class="trait" href="https://doc.rust-lang.org/1.84.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><D>(self, deserializer: D) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>, D::<a class="associatedtype" href="../trait.Deserializer.html#associatedtype.Error" title="type serde::Deserializer::Error">Error</a>>
|
||||
<span class="where">where D: <a class="trait" href="../trait.Deserializer.html" title="trait serde::Deserializer">Deserializer</a><'de></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<T></code> but it would be a freshly allocated
|
||||
<code>Vec<T></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<<span class="lifetime">'de</span>, T: Deserialize<<span class="lifetime">'de</span>>>() -> <span class="prelude-ty">Result</span><T, Error></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<<span class="lifetime">'de</span>, T: DeserializeSeed<<span class="lifetime">'de</span>>>(seed: T) -> <span class="prelude-ty">Result</span><T::Value, Error></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<T></code> for each subarray would be slow. Instead we
|
||||
would like to allocate a single <code>Vec<T></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<T>. 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<<span class="lifetime">'a</span>, T: <span class="lifetime">'a</span>>(<span class="kw-2">&</span><span class="lifetime">'a </span><span class="kw-2">mut </span>Vec<T>);
|
||||
|
||||
<span class="kw">impl</span><<span class="lifetime">'de</span>, <span class="lifetime">'a</span>, T> DeserializeSeed<<span class="lifetime">'de</span>> <span class="kw">for </span>ExtendVec<<span class="lifetime">'a</span>, T>
|
||||
<span class="kw">where
|
||||
</span>T: Deserialize<<span class="lifetime">'de</span>>,
|
||||
{
|
||||
<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<D>(<span class="self">self</span>, deserializer: D) -> <span class="prelude-ty">Result</span><<span class="self">Self</span>::Value, D::Error>
|
||||
<span class="kw">where
|
||||
</span>D: Deserializer<<span class="lifetime">'de</span>>,
|
||||
{
|
||||
<span class="comment">// Visitor implementation that will walk an inner array of the JSON
|
||||
// input.
|
||||
</span><span class="kw">struct </span>ExtendVecVisitor<<span class="lifetime">'a</span>, T: <span class="lifetime">'a</span>>(<span class="kw-2">&</span><span class="lifetime">'a </span><span class="kw-2">mut </span>Vec<T>);
|
||||
|
||||
<span class="kw">impl</span><<span class="lifetime">'de</span>, <span class="lifetime">'a</span>, T> Visitor<<span class="lifetime">'de</span>> <span class="kw">for </span>ExtendVecVisitor<<span class="lifetime">'a</span>, T>
|
||||
<span class="kw">where
|
||||
</span>T: Deserialize<<span class="lifetime">'de</span>>,
|
||||
{
|
||||
<span class="kw">type </span>Value = ();
|
||||
|
||||
<span class="kw">fn </span>expecting(<span class="kw-2">&</span><span class="self">self</span>, formatter: <span class="kw-2">&mut </span>fmt::Formatter) -> fmt::Result {
|
||||
<span class="macro">write!</span>(formatter, <span class="string">"an array of integers"</span>)
|
||||
}
|
||||
|
||||
<span class="kw">fn </span>visit_seq<A>(<span class="self">self</span>, <span class="kw-2">mut </span>seq: A) -> <span class="prelude-ty">Result</span><(), A::Error>
|
||||
<span class="kw">where
|
||||
</span>A: SeqAccess<<span class="lifetime">'de</span>>,
|
||||
{
|
||||
<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<T>(PhantomData<T>);
|
||||
|
||||
<span class="kw">impl</span><<span class="lifetime">'de</span>, T> Visitor<<span class="lifetime">'de</span>> <span class="kw">for </span>FlattenedVecVisitor<T>
|
||||
<span class="kw">where
|
||||
</span>T: Deserialize<<span class="lifetime">'de</span>>,
|
||||
{
|
||||
<span class="comment">// This Visitor constructs a single Vec<T> to hold the flattened
|
||||
// contents of the inner arrays.
|
||||
</span><span class="kw">type </span>Value = Vec<T>;
|
||||
|
||||
<span class="kw">fn </span>expecting(<span class="kw-2">&</span><span class="self">self</span>, formatter: <span class="kw-2">&mut </span>fmt::Formatter) -> fmt::Result {
|
||||
<span class="macro">write!</span>(formatter, <span class="string">"an array of arrays"</span>)
|
||||
}
|
||||
|
||||
<span class="kw">fn </span>visit_seq<A>(<span class="self">self</span>, <span class="kw-2">mut </span>seq: A) -> <span class="prelude-ty">Result</span><Vec<T>, A::Error>
|
||||
<span class="kw">where
|
||||
</span>A: SeqAccess<<span class="lifetime">'de</span>>,
|
||||
{
|
||||
<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">&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<u64> = 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/de/mod.rs.html#780">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/de/mod.rs.html#784-786">Source</a><h4 class="code-header">fn <a href="#tymethod.deserialize" class="fn">deserialize</a><D>(self, deserializer: D) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>, D::<a class="associatedtype" href="../trait.Deserializer.html#associatedtype.Error" title="type serde::Deserializer::Error">Error</a>><div class="where">where
|
||||
D: <a class="trait" href="../trait.Deserializer.html" title="trait serde::Deserializer">Deserializer</a><'de>,</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.84.1/reference/items/traits.html#object-safety">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/de/mod.rs.html#789-802">Source</a><a href="#impl-DeserializeSeed%3C'de%3E-for-PhantomData%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<'de, T> <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de> for <a class="struct" href="https://doc.rust-lang.org/1.84.1/core/marker/struct.PhantomData.html" title="struct core::marker::PhantomData">PhantomData</a><T><div class="where">where
|
||||
T: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Value-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde/de/mod.rs.html#793">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/de/mod.rs.html#796-801">Source</a><a href="#method.deserialize" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.deserialize" class="fn">deserialize</a><D>(self, deserializer: D) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, D::<a class="associatedtype" href="../trait.Deserializer.html#associatedtype.Error" title="type serde::Deserializer::Error">Error</a>><div class="where">where
|
||||
D: <a class="trait" href="../trait.Deserializer.html" title="trait serde::Deserializer">Deserializer</a><'de>,</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/de/trait.DeserializeSeed.js" data-ignore-extern-crates="core" async></script></section></div></main></body></html>
|
||||
451
serde/de/trait.Deserializer.html
Normal file
451
serde/de/trait.Deserializer.html
Normal file
File diff suppressed because one or more lines are too long
46
serde/de/trait.EnumAccess.html
Normal file
46
serde/de/trait.EnumAccess.html
Normal 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::de - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde/index.html">serde</a><span class="version">1.0.216</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>de</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">serde</a>::<wbr><a href="index.html">de</a></span><h1>Trait <span class="trait">EnumAccess</span><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/de/mod.rs.html#1984-2011">Source</a> </span></div><pre class="rust item-decl"><code>pub trait EnumAccess<'de>: <a class="trait" href="https://doc.rust-lang.org/1.84.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::de::Error">Error</a>;
|
||||
type <a href="#associatedtype.Variant" class="associatedtype">Variant</a>: <a class="trait" href="trait.VariantAccess.html" title="trait serde::de::VariantAccess">VariantAccess</a><'de, Error = Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Error" title="type serde::de::EnumAccess::Error">Error</a>>;
|
||||
|
||||
// Required method
|
||||
fn <a href="#tymethod.variant_seed" class="fn">variant_seed</a><V>(
|
||||
self,
|
||||
seed: V,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(V::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>, Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Variant" title="type serde::de::EnumAccess::Variant">Variant</a>), Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Error" title="type serde::de::EnumAccess::Error">Error</a>>
|
||||
<span class="where">where V: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de></span>;
|
||||
|
||||
// Provided method
|
||||
fn <a href="#method.variant" class="fn">variant</a><V>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(V, Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Variant" title="type serde::de::EnumAccess::Variant">Variant</a>), Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Error" title="type serde::de::EnumAccess::Error">Error</a>>
|
||||
<span class="where">where V: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de></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/de/mod.rs.html#1987">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::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/de/mod.rs.html#1990">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::de::VariantAccess">VariantAccess</a><'de, Error = Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Error" title="type serde::de::EnumAccess::Error">Error</a>></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/de/mod.rs.html#1996-1998">Source</a><h4 class="code-header">fn <a href="#tymethod.variant_seed" class="fn">variant_seed</a><V>(
|
||||
self,
|
||||
seed: V,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(V::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>, Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Variant" title="type serde::de::EnumAccess::Variant">Variant</a>), Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Error" title="type serde::de::EnumAccess::Error">Error</a>><div class="where">where
|
||||
V: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de>,</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/de/mod.rs.html#2005-2010">Source</a><h4 class="code-header">fn <a href="#method.variant" class="fn">variant</a><V>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(V, Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Variant" title="type serde::de::EnumAccess::Variant">Variant</a>), Self::<a class="associatedtype" href="trait.EnumAccess.html#associatedtype.Error" title="type serde::de::EnumAccess::Error">Error</a>><div class="where">where
|
||||
V: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de>,</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.84.1/reference/items/traits.html#object-safety">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/de/value.rs.html#843-856">Source</a><a href="#impl-EnumAccess%3C'de%3E-for-CowStrDeserializer%3C'a,+E%3E" class="anchor">§</a><h3 class="code-header">impl<'de, 'a, E> <a class="trait" href="trait.EnumAccess.html" title="trait serde::de::EnumAccess">EnumAccess</a><'de> for <a class="struct" href="value/struct.CowStrDeserializer.html" title="struct serde::de::value::CowStrDeserializer">CowStrDeserializer</a><'a, E><div class="where">where
|
||||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde/de/value.rs.html#847">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/de/value.rs.html#848">Source</a><a href="#associatedtype.Variant-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Variant" class="associatedtype">Variant</a> = UnitOnly<E></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/de/value.rs.html#517-530">Source</a><a href="#impl-EnumAccess%3C'de%3E-for-StrDeserializer%3C'a,+E%3E" class="anchor">§</a><h3 class="code-header">impl<'de, 'a, E> <a class="trait" href="trait.EnumAccess.html" title="trait serde::de::EnumAccess">EnumAccess</a><'de> for <a class="struct" href="value/struct.StrDeserializer.html" title="struct serde::de::value::StrDeserializer">StrDeserializer</a><'a, E><div class="where">where
|
||||
E: <a class="trait" href="trait.Error.html" title="trait serde::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/de/value.rs.html#521">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/de/value.rs.html#522">Source</a><a href="#associatedtype.Variant-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Variant" class="associatedtype">Variant</a> = UnitOnly<E></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/de/value.rs.html#1664-1680">Source</a><a href="#impl-EnumAccess%3C'de%3E-for-MapAccessDeserializer%3CA%3E" class="anchor">§</a><h3 class="code-header">impl<'de, A> <a class="trait" href="trait.EnumAccess.html" title="trait serde::de::EnumAccess">EnumAccess</a><'de> for <a class="struct" href="value/struct.MapAccessDeserializer.html" title="struct serde::de::value::MapAccessDeserializer">MapAccessDeserializer</a><A><div class="where">where
|
||||
A: <a class="trait" href="trait.MapAccess.html" title="trait serde::de::MapAccess">MapAccess</a><'de>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-3" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde/de/value.rs.html#1668">Source</a><a href="#associatedtype.Error-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <A as <a class="trait" href="trait.MapAccess.html" title="trait serde::de::MapAccess">MapAccess</a><'de>>::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a></h4></section><section id="associatedtype.Variant-3" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde/de/value.rs.html#1669">Source</a><a href="#associatedtype.Variant-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Variant" class="associatedtype">Variant</a> = MapAsEnum<A></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/de/value.rs.html#607-620">Source</a><a href="#impl-EnumAccess%3C'de%3E-for-BorrowedStrDeserializer%3C'de,+E%3E" class="anchor">§</a><h3 class="code-header">impl<'de, E> <a class="trait" href="trait.EnumAccess.html" title="trait serde::de::EnumAccess">EnumAccess</a><'de> for <a class="struct" href="value/struct.BorrowedStrDeserializer.html" title="struct serde::de::value::BorrowedStrDeserializer">BorrowedStrDeserializer</a><'de, E><div class="where">where
|
||||
E: <a class="trait" href="trait.Error.html" title="trait serde::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/de/value.rs.html#611">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/de/value.rs.html#612">Source</a><a href="#associatedtype.Variant-4" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Variant" class="associatedtype">Variant</a> = UnitOnly<E></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/de/value.rs.html#723-736">Source</a><a href="#impl-EnumAccess%3C'de%3E-for-StringDeserializer%3CE%3E" class="anchor">§</a><h3 class="code-header">impl<'de, E> <a class="trait" href="trait.EnumAccess.html" title="trait serde::de::EnumAccess">EnumAccess</a><'de> for <a class="struct" href="value/struct.StringDeserializer.html" title="struct serde::de::value::StringDeserializer">StringDeserializer</a><E><div class="where">where
|
||||
E: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-5" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde/de/value.rs.html#727">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/de/value.rs.html#728">Source</a><a href="#associatedtype.Variant-5" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Variant" class="associatedtype">Variant</a> = UnitOnly<E></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/de/value.rs.html#417-430">Source</a><a href="#impl-EnumAccess%3C'de%3E-for-U32Deserializer%3CE%3E" class="anchor">§</a><h3 class="code-header">impl<'de, E> <a class="trait" href="trait.EnumAccess.html" title="trait serde::de::EnumAccess">EnumAccess</a><'de> for <a class="struct" href="value/struct.U32Deserializer.html" title="struct serde::de::value::U32Deserializer">U32Deserializer</a><E><div class="where">where
|
||||
E: <a class="trait" href="trait.Error.html" title="trait serde::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/de/value.rs.html#421">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/de/value.rs.html#422">Source</a><a href="#associatedtype.Variant-6" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Variant" class="associatedtype">Variant</a> = UnitOnly<E></h4></section></div></details></div><script src="../../trait.impl/serde/de/trait.EnumAccess.js" async></script></section></div></main></body></html>
|
||||
79
serde/de/trait.Error.html
Normal file
79
serde/de/trait.Error.html
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
<!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::de - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde/index.html">serde</a><span class="version">1.0.216</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>de</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">serde</a>::<wbr><a href="index.html">de</a></span><h1>Trait <span class="trait">Error</span><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/de/mod.rs.html#300">Source</a> </span></div><pre class="rust item-decl"><code>pub trait Error: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/error/trait.Error.html" title="trait core::error::Error">StdError</a> {
|
||||
// Required method
|
||||
fn <a href="#tymethod.custom" class="fn">custom</a><T>(msg: T) -> Self
|
||||
<span class="where">where T: <a class="trait" href="https://doc.rust-lang.org/1.84.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::de::Unexpected">Unexpected</a><'_>, exp: &dyn <a class="trait" href="trait.Expected.html" title="trait serde::de::Expected">Expected</a>) -> 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::de::Unexpected">Unexpected</a><'_>, exp: &dyn <a class="trait" href="trait.Expected.html" title="trait serde::de::Expected">Expected</a>) -> 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.84.1/std/primitive.usize.html">usize</a>, exp: &dyn <a class="trait" href="trait.Expected.html" title="trait serde::de::Expected">Expected</a>) -> Self { ... }
|
||||
<span class="item-spacer"></span> fn <a href="#method.unknown_variant" class="fn">unknown_variant</a>(variant: &<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>, expected: &'static [&'static <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>]) -> Self { ... }
|
||||
<span class="item-spacer"></span> fn <a href="#method.unknown_field" class="fn">unknown_field</a>(field: &<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>, expected: &'static [&'static <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>]) -> Self { ... }
|
||||
<span class="item-spacer"></span> fn <a href="#method.missing_field" class="fn">missing_field</a>(field: &'static <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>) -> Self { ... }
|
||||
<span class="item-spacer"></span> fn <a href="#method.duplicate_field" class="fn">duplicate_field</a>(field: &'static <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>) -> 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/de/mod.rs.html#300">Source</a><h4 class="code-header">fn <a href="#tymethod.custom" class="fn">custom</a><T>(msg: T) -> Self<div class="where">where
|
||||
T: <a class="trait" href="https://doc.rust-lang.org/1.84.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><<span class="lifetime">'de</span>> Deserialize<<span class="lifetime">'de</span>> <span class="kw">for </span>IpAddr {
|
||||
<span class="kw">fn </span>deserialize<D>(deserializer: D) -> <span class="prelude-ty">Result</span><<span class="self">Self</span>, D::Error>
|
||||
<span class="kw">where
|
||||
</span>D: Deserializer<<span class="lifetime">'de</span>>,
|
||||
{
|
||||
<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/de/mod.rs.html#300">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::de::Unexpected">Unexpected</a><'_>, exp: &dyn <a class="trait" href="trait.Expected.html" title="trait serde::de::Expected">Expected</a>) -> 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/de/mod.rs.html#300">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::de::Unexpected">Unexpected</a><'_>, exp: &dyn <a class="trait" href="trait.Expected.html" title="trait serde::de::Expected">Expected</a>) -> 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/de/mod.rs.html#300">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.84.1/std/primitive.usize.html">usize</a>, exp: &dyn <a class="trait" href="trait.Expected.html" title="trait serde::de::Expected">Expected</a>) -> 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/de/mod.rs.html#300">Source</a><h4 class="code-header">fn <a href="#method.unknown_variant" class="fn">unknown_variant</a>(variant: &<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>, expected: &'static [&'static <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>]) -> 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/de/mod.rs.html#300">Source</a><h4 class="code-header">fn <a href="#method.unknown_field" class="fn">unknown_field</a>(field: &<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>, expected: &'static [&'static <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>]) -> 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/de/mod.rs.html#300">Source</a><h4 class="code-header">fn <a href="#method.missing_field" class="fn">missing_field</a>(field: &'static <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>) -> 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/de/mod.rs.html#300">Source</a><h4 class="code-header">fn <a href="#method.duplicate_field" class="fn">duplicate_field</a>(field: &'static <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>) -> 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.84.1/reference/items/traits.html#object-safety">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/de/value.rs.html#60-81">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::de::Error">Error</a> for <a class="struct" href="value/struct.Error.html" title="struct serde::de::value::Error">Error</a></h3></section></div><script src="../../trait.impl/serde/de/trait.Error.js" async></script></section></div></main></body></html>
|
||||
30
serde/de/trait.Expected.html
Normal file
30
serde/de/trait.Expected.html
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<!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::de - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde/index.html">serde</a><span class="version">1.0.216</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="&str">&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>de</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">serde</a>::<wbr><a href="index.html">de</a></span><h1>Trait <span class="trait">Expected</span><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/de/mod.rs.html#474-478">Source</a> </span></div><pre class="rust item-decl"><code>pub trait Expected {
|
||||
// Required method
|
||||
fn <a href="#tymethod.fmt" class="fn">fmt</a>(&self, formatter: &mut <a class="struct" href="https://doc.rust-lang.org/1.84.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.84.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>&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<E>(<span class="self">self</span>, v: bool) -> <span class="prelude-ty">Result</span><<span class="self">Self</span>::Value, E>
|
||||
<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">&</span><span class="self">self</span>))
|
||||
}</code></pre></div>
|
||||
<p>Outside of a <code>Visitor</code>, <code>&"..."</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">&</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/de/mod.rs.html#477">Source</a><h4 class="code-header">fn <a href="#tymethod.fmt" class="fn">fmt</a>(&self, formatter: &mut <a class="struct" href="https://doc.rust-lang.org/1.84.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.84.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/de/mod.rs.html#495-499">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.84.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::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/de/mod.rs.html#496-498">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/core/fmt/trait.Display.html#tymethod.fmt" class="fn">fmt</a>(&self, formatter: &mut <a class="struct" href="https://doc.rust-lang.org/1.84.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.84.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.84.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/de/mod.rs.html#489-493">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::de::Expected">Expected</a> for &<a class="primitive" href="https://doc.rust-lang.org/1.84.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/de/mod.rs.html#490-492">Source</a><a href="#method.fmt-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.fmt" class="fn">fmt</a>(&self, formatter: &mut <a class="struct" href="https://doc.rust-lang.org/1.84.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.84.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/de/mod.rs.html#480-487">Source</a><a href="#impl-Expected-for-T" class="anchor">§</a><h3 class="code-header">impl<'de, T> <a class="trait" href="trait.Expected.html" title="trait serde::de::Expected">Expected</a> for T<div class="where">where
|
||||
T: <a class="trait" href="trait.Visitor.html" title="trait serde::de::Visitor">Visitor</a><'de>,</div></h3></section></div><script src="../../trait.impl/serde/de/trait.Expected.js" data-ignore-extern-crates="std" async></script></section></div></main></body></html>
|
||||
101
serde/de/trait.IntoDeserializer.html
Normal file
101
serde/de/trait.IntoDeserializer.html
Normal file
File diff suppressed because one or more lines are too long
101
serde/de/trait.MapAccess.html
Normal file
101
serde/de/trait.MapAccess.html
Normal 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::de - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde/index.html">serde</a><span class="version">1.0.216</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="&mut A">&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>de</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">serde</a>::<wbr><a href="index.html">de</a></span><h1>Trait <span class="trait">MapAccess</span><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/de/mod.rs.html#1792-1895">Source</a> </span></div><pre class="rust item-decl"><code>pub trait MapAccess<'de> {
|
||||
type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>;
|
||||
|
||||
// Required methods
|
||||
fn <a href="#tymethod.next_key_seed" class="fn">next_key_seed</a><K>(
|
||||
&mut self,
|
||||
seed: K,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><K::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>>, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>>
|
||||
<span class="where">where K: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de></span>;
|
||||
<span class="item-spacer"></span> fn <a href="#tymethod.next_value_seed" class="fn">next_value_seed</a><V>(&mut self, seed: V) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><V::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>>
|
||||
<span class="where">where V: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de></span>;
|
||||
|
||||
// Provided methods
|
||||
fn <a href="#method.next_entry_seed" class="fn">next_entry_seed</a><K, V>(
|
||||
&mut self,
|
||||
kseed: K,
|
||||
vseed: V,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(K::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>, V::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>)>, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>>
|
||||
<span class="where">where K: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de>,
|
||||
V: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de></span> { ... }
|
||||
<span class="item-spacer"></span> fn <a href="#method.next_key" class="fn">next_key</a><K>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><K>, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>>
|
||||
<span class="where">where K: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de></span> { ... }
|
||||
<span class="item-spacer"></span> fn <a href="#method.next_value" class="fn">next_value</a><V>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><V, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>>
|
||||
<span class="where">where V: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de></span> { ... }
|
||||
<span class="item-spacer"></span> fn <a href="#method.next_entry" class="fn">next_entry</a><K, V>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.tuple.html">(K, V)</a>>, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>>
|
||||
<span class="where">where K: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de>,
|
||||
V: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de></span> { ... }
|
||||
<span class="item-spacer"></span> fn <a href="#method.size_hint" class="fn">size_hint</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>> { ... }
|
||||
}</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/de/mod.rs.html#1795">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::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/de/mod.rs.html#1802-1804">Source</a><h4 class="code-header">fn <a href="#tymethod.next_key_seed" class="fn">next_key_seed</a><K>(&mut self, seed: K) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><K::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>>, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>><div class="where">where
|
||||
K: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de>,</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/de/mod.rs.html#1815-1817">Source</a><h4 class="code-header">fn <a href="#tymethod.next_value_seed" class="fn">next_value_seed</a><V>(&mut self, seed: V) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><V::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>><div class="where">where
|
||||
V: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de>,</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/de/mod.rs.html#1828-1844">Source</a><h4 class="code-header">fn <a href="#method.next_entry_seed" class="fn">next_entry_seed</a><K, V>(
|
||||
&mut self,
|
||||
kseed: K,
|
||||
vseed: V,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(K::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>, V::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>)>, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>><div class="where">where
|
||||
K: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de>,
|
||||
V: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de>,</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/de/mod.rs.html#1852-1857">Source</a><h4 class="code-header">fn <a href="#method.next_key" class="fn">next_key</a><K>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><K>, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>><div class="where">where
|
||||
K: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de>,</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/de/mod.rs.html#1869-1874">Source</a><h4 class="code-header">fn <a href="#method.next_value" class="fn">next_value</a><V>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><V, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>><div class="where">where
|
||||
V: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de>,</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/de/mod.rs.html#1882-1888">Source</a><h4 class="code-header">fn <a href="#method.next_entry" class="fn">next_entry</a><K, V>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.tuple.html">(K, V)</a>>, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>><div class="where">where
|
||||
K: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de>,
|
||||
V: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de>,</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/de/mod.rs.html#1892-1894">Source</a><h4 class="code-header">fn <a href="#method.size_hint" class="fn">size_hint</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>></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.84.1/reference/items/traits.html#object-safety">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/de/mod.rs.html#1897-1961">Source</a><a href="#impl-MapAccess%3C'de%3E-for-%26mut+A" class="anchor">§</a><h3 class="code-header">impl<'de, A> <a class="trait" href="trait.MapAccess.html" title="trait serde::de::MapAccess">MapAccess</a><'de> for <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&mut A</a><div class="where">where
|
||||
A: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.MapAccess.html" title="trait serde::de::MapAccess">MapAccess</a><'de>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1901">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <A as <a class="trait" href="trait.MapAccess.html" title="trait serde::de::MapAccess">MapAccess</a><'de>>::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a></h4></section><section id="method.next_key_seed" class="method trait-impl"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1904-1909">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><K>(&mut self, seed: K) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><K::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>>, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>><div class="where">where
|
||||
K: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de>,</div></h4></section><section id="method.next_value_seed" class="method trait-impl"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1912-1917">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><V>(&mut self, seed: V) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><V::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>><div class="where">where
|
||||
V: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de>,</div></h4></section><section id="method.next_entry_seed-1" class="method trait-impl"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1920-1930">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><K, V>(
|
||||
&mut self,
|
||||
kseed: K,
|
||||
vseed: V,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(K::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>, V::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>)>, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>><div class="where">where
|
||||
K: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de>,
|
||||
V: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de>,</div></h4></section><section id="method.next_entry-1" class="method trait-impl"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1933-1939">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><K, V>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.tuple.html">(K, V)</a>>, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>><div class="where">where
|
||||
K: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de>,
|
||||
V: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de>,</div></h4></section><section id="method.next_key-1" class="method trait-impl"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1942-1947">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><K>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><K>, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>><div class="where">where
|
||||
K: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de>,</div></h4></section><section id="method.next_value-1" class="method trait-impl"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1950-1955">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><V>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><V, Self::<a class="associatedtype" href="trait.MapAccess.html#associatedtype.Error" title="type serde::de::MapAccess::Error">Error</a>><div class="where">where
|
||||
V: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de>,</div></h4></section><section id="method.size_hint-1" class="method trait-impl"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1958-1960">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>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>></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/de/value.rs.html#1352-1408">Source</a><a href="#impl-MapAccess%3C'de%3E-for-MapDeserializer%3C'de,+I,+E%3E" class="anchor">§</a><h3 class="code-header">impl<'de, I, E> <a class="trait" href="trait.MapAccess.html" title="trait serde::de::MapAccess">MapAccess</a><'de> for <a class="struct" href="value/struct.MapDeserializer.html" title="struct serde::de::value::MapDeserializer">MapDeserializer</a><'de, I, E><div class="where">where
|
||||
I: <a class="trait" href="https://doc.rust-lang.org/1.84.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.84.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: Pair,
|
||||
<I::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as Pair>::First: <a class="trait" href="trait.IntoDeserializer.html" title="trait serde::de::IntoDeserializer">IntoDeserializer</a><'de, E>,
|
||||
<I::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as Pair>::Second: <a class="trait" href="trait.IntoDeserializer.html" title="trait serde::de::IntoDeserializer">IntoDeserializer</a><'de, E>,
|
||||
E: <a class="trait" href="trait.Error.html" title="trait serde::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/de/value.rs.html#1360">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/de/trait.MapAccess.js" async></script></section></div></main></body></html>
|
||||
55
serde/de/trait.SeqAccess.html
Normal file
55
serde/de/trait.SeqAccess.html
Normal 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::de - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde/index.html">serde</a><span class="version">1.0.216</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="&mut A">&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>de</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">serde</a>::<wbr><a href="index.html">de</a></span><h1>Trait <span class="trait">SeqAccess</span><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/de/mod.rs.html#1710-1742">Source</a> </span></div><pre class="rust item-decl"><code>pub trait SeqAccess<'de> {
|
||||
type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="trait.Error.html" title="trait serde::de::Error">Error</a>;
|
||||
|
||||
// Required method
|
||||
fn <a href="#tymethod.next_element_seed" class="fn">next_element_seed</a><T>(
|
||||
&mut self,
|
||||
seed: T,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><T::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>>, Self::<a class="associatedtype" href="trait.SeqAccess.html#associatedtype.Error" title="type serde::de::SeqAccess::Error">Error</a>>
|
||||
<span class="where">where T: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de></span>;
|
||||
|
||||
// Provided methods
|
||||
fn <a href="#method.next_element" class="fn">next_element</a><T>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><T>, Self::<a class="associatedtype" href="trait.SeqAccess.html#associatedtype.Error" title="type serde::de::SeqAccess::Error">Error</a>>
|
||||
<span class="where">where T: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de></span> { ... }
|
||||
<span class="item-spacer"></span> fn <a href="#method.size_hint" class="fn">size_hint</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>> { ... }
|
||||
}</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/de/mod.rs.html#1713">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::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/de/mod.rs.html#1720-1722">Source</a><h4 class="code-header">fn <a href="#tymethod.next_element_seed" class="fn">next_element_seed</a><T>(
|
||||
&mut self,
|
||||
seed: T,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><T::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>>, Self::<a class="associatedtype" href="trait.SeqAccess.html#associatedtype.Error" title="type serde::de::SeqAccess::Error">Error</a>><div class="where">where
|
||||
T: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de>,</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/de/mod.rs.html#1730-1735">Source</a><h4 class="code-header">fn <a href="#method.next_element" class="fn">next_element</a><T>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><T>, Self::<a class="associatedtype" href="trait.SeqAccess.html#associatedtype.Error" title="type serde::de::SeqAccess::Error">Error</a>><div class="where">where
|
||||
T: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de>,</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/de/mod.rs.html#1739-1741">Source</a><h4 class="code-header">fn <a href="#method.size_hint" class="fn">size_hint</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>></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.84.1/reference/items/traits.html#object-safety">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/de/mod.rs.html#1744-1770">Source</a><a href="#impl-SeqAccess%3C'de%3E-for-%26mut+A" class="anchor">§</a><h3 class="code-header">impl<'de, A> <a class="trait" href="trait.SeqAccess.html" title="trait serde::de::SeqAccess">SeqAccess</a><'de> for <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&mut A</a><div class="where">where
|
||||
A: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.SeqAccess.html" title="trait serde::de::SeqAccess">SeqAccess</a><'de>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1748">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <A as <a class="trait" href="trait.SeqAccess.html" title="trait serde::de::SeqAccess">SeqAccess</a><'de>>::<a class="associatedtype" href="trait.SeqAccess.html#associatedtype.Error" title="type serde::de::SeqAccess::Error">Error</a></h4></section><section id="method.next_element_seed" class="method trait-impl"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1751-1756">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><T>(
|
||||
&mut self,
|
||||
seed: T,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><T::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>>, Self::<a class="associatedtype" href="trait.SeqAccess.html#associatedtype.Error" title="type serde::de::SeqAccess::Error">Error</a>><div class="where">where
|
||||
T: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de>,</div></h4></section><section id="method.next_element-1" class="method trait-impl"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1759-1764">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><T>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><T>, Self::<a class="associatedtype" href="trait.SeqAccess.html#associatedtype.Error" title="type serde::de::SeqAccess::Error">Error</a>><div class="where">where
|
||||
T: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de>,</div></h4></section><section id="method.size_hint-1" class="method trait-impl"><a class="src rightside" href="../../src/serde/de/mod.rs.html#1767-1769">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>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>></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/de/value.rs.html#1410-1436">Source</a><a href="#impl-SeqAccess%3C'de%3E-for-MapDeserializer%3C'de,+I,+E%3E" class="anchor">§</a><h3 class="code-header">impl<'de, I, E> <a class="trait" href="trait.SeqAccess.html" title="trait serde::de::SeqAccess">SeqAccess</a><'de> for <a class="struct" href="value/struct.MapDeserializer.html" title="struct serde::de::value::MapDeserializer">MapDeserializer</a><'de, I, E><div class="where">where
|
||||
I: <a class="trait" href="https://doc.rust-lang.org/1.84.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.84.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a>: Pair,
|
||||
<I::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as Pair>::First: <a class="trait" href="trait.IntoDeserializer.html" title="trait serde::de::IntoDeserializer">IntoDeserializer</a><'de, E>,
|
||||
<I::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a> as Pair>::Second: <a class="trait" href="trait.IntoDeserializer.html" title="trait serde::de::IntoDeserializer">IntoDeserializer</a><'de, E>,
|
||||
E: <a class="trait" href="trait.Error.html" title="trait serde::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/de/value.rs.html#1418">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/de/value.rs.html#1081-1105">Source</a><a href="#impl-SeqAccess%3C'de%3E-for-SeqDeserializer%3CI,+E%3E" class="anchor">§</a><h3 class="code-header">impl<'de, I, T, E> <a class="trait" href="trait.SeqAccess.html" title="trait serde::de::SeqAccess">SeqAccess</a><'de> for <a class="struct" href="value/struct.SeqDeserializer.html" title="struct serde::de::value::SeqDeserializer">SeqDeserializer</a><I, E><div class="where">where
|
||||
I: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = T>,
|
||||
T: <a class="trait" href="trait.IntoDeserializer.html" title="trait serde::de::IntoDeserializer">IntoDeserializer</a><'de, E>,
|
||||
E: <a class="trait" href="trait.Error.html" title="trait serde::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/de/value.rs.html#1087">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/de/trait.SeqAccess.js" async></script></section></div></main></body></html>
|
||||
105
serde/de/trait.VariantAccess.html
Normal file
105
serde/de/trait.VariantAccess.html
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
<!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::de - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde/index.html">serde</a><span class="version">1.0.216</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>de</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">serde</a>::<wbr><a href="index.html">de</a></span><h1>Trait <span class="trait">VariantAccess</span><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/de/mod.rs.html#2031-2223">Source</a> </span></div><pre class="rust item-decl"><code>pub trait VariantAccess<'de>: <a class="trait" href="https://doc.rust-lang.org/1.84.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::de::Error">Error</a>;
|
||||
|
||||
// Required methods
|
||||
fn <a href="#tymethod.unit_variant" class="fn">unit_variant</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>>;
|
||||
<span class="item-spacer"></span> fn <a href="#tymethod.newtype_variant_seed" class="fn">newtype_variant_seed</a><T>(self, seed: T) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>>
|
||||
<span class="where">where T: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de></span>;
|
||||
<span class="item-spacer"></span> fn <a href="#tymethod.tuple_variant" class="fn">tuple_variant</a><V>(
|
||||
self,
|
||||
len: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>,
|
||||
visitor: V,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><V::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>>
|
||||
<span class="where">where V: <a class="trait" href="trait.Visitor.html" title="trait serde::de::Visitor">Visitor</a><'de></span>;
|
||||
<span class="item-spacer"></span> fn <a href="#tymethod.struct_variant" class="fn">struct_variant</a><V>(
|
||||
self,
|
||||
fields: &'static [&'static <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>],
|
||||
visitor: V,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><V::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>>
|
||||
<span class="where">where V: <a class="trait" href="trait.Visitor.html" title="trait serde::de::Visitor">Visitor</a><'de></span>;
|
||||
|
||||
// Provided method
|
||||
fn <a href="#method.newtype_variant" class="fn">newtype_variant</a><T>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>>
|
||||
<span class="where">where T: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de></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/de/mod.rs.html#2034">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::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/de/mod.rs.html#2071">Source</a><h4 class="code-header">fn <a href="#tymethod.unit_variant" class="fn">unit_variant</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>></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>) -> <span class="prelude-ty">Result</span><(), <span class="self">Self</span>::Error> {
|
||||
<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">&</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/de/mod.rs.html#2113-2115">Source</a><h4 class="code-header">fn <a href="#tymethod.newtype_variant_seed" class="fn">newtype_variant_seed</a><T>(self, seed: T) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T::<a class="associatedtype" href="trait.DeserializeSeed.html#associatedtype.Value" title="type serde::de::DeserializeSeed::Value">Value</a>, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>><div class="where">where
|
||||
T: <a class="trait" href="trait.DeserializeSeed.html" title="trait serde::de::DeserializeSeed">DeserializeSeed</a><'de>,</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<T>(<span class="self">self</span>, _seed: T) -> <span class="prelude-ty">Result</span><T::Value, <span class="self">Self</span>::Error>
|
||||
<span class="kw">where
|
||||
</span>T: DeserializeSeed<<span class="lifetime">'de</span>>,
|
||||
{
|
||||
<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">&</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/de/mod.rs.html#2169-2171">Source</a><h4 class="code-header">fn <a href="#tymethod.tuple_variant" class="fn">tuple_variant</a><V>(
|
||||
self,
|
||||
len: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>,
|
||||
visitor: V,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><V::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>><div class="where">where
|
||||
V: <a class="trait" href="trait.Visitor.html" title="trait serde::de::Visitor">Visitor</a><'de>,</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<V>(<span class="self">self</span>, _len: usize, _visitor: V) -> <span class="prelude-ty">Result</span><V::Value, <span class="self">Self</span>::Error>
|
||||
<span class="kw">where
|
||||
</span>V: Visitor<<span class="lifetime">'de</span>>,
|
||||
{
|
||||
<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">&</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/de/mod.rs.html#2216-2222">Source</a><h4 class="code-header">fn <a href="#tymethod.struct_variant" class="fn">struct_variant</a><V>(
|
||||
self,
|
||||
fields: &'static [&'static <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>],
|
||||
visitor: V,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><V::<a class="associatedtype" href="trait.Visitor.html#associatedtype.Value" title="type serde::de::Visitor::Value">Value</a>, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>><div class="where">where
|
||||
V: <a class="trait" href="trait.Visitor.html" title="trait serde::de::Visitor">Visitor</a><'de>,</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<V>(
|
||||
<span class="self">self</span>,
|
||||
_fields: <span class="kw-2">&</span><span class="lifetime">'static </span>[<span class="kw-2">&</span><span class="lifetime">'static </span>str],
|
||||
_visitor: V,
|
||||
) -> <span class="prelude-ty">Result</span><V::Value, <span class="self">Self</span>::Error>
|
||||
<span class="kw">where
|
||||
</span>V: Visitor<<span class="lifetime">'de</span>>,
|
||||
{
|
||||
<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">&</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/de/mod.rs.html#2123-2128">Source</a><h4 class="code-header">fn <a href="#method.newtype_variant" class="fn">newtype_variant</a><T>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, Self::<a class="associatedtype" href="trait.VariantAccess.html#associatedtype.Error" title="type serde::de::VariantAccess::Error">Error</a>><div class="where">where
|
||||
T: <a class="trait" href="../trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a><'de>,</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.84.1/reference/items/traits.html#object-safety">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/de/trait.VariantAccess.js" async></script></section></div></main></body></html>
|
||||
236
serde/de/trait.Visitor.html
Normal file
236
serde/de/trait.Visitor.html
Normal file
File diff suppressed because one or more lines are too long
39
serde/de/value/index.html
Normal file
39
serde/de/value/index.html
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<!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::de::value - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../serde/index.html">serde</a><span class="version">1.0.216</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>de</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../../index.html">serde</a>::<wbr><a href="../index.html">de</a></span><h1>Module <span>value</span><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/de/value.rs.html#1-1894">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">&</span>str) -> <span class="prelude-ty">Result</span><<span class="self">Self</span>, <span class="self">Self</span>::Err> {
|
||||
<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><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.BoolDeserializer.html" title="struct serde::de::value::BoolDeserializer">Bool<wbr>Deserializer</a></div><div class="desc docblock-short">A deserializer holding
|
||||
a <code>bool</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.BorrowedBytesDeserializer.html" title="struct serde::de::value::BorrowedBytesDeserializer">Borrowed<wbr>Bytes<wbr>Deserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>&[u8]</code> with a lifetime tied to another
|
||||
deserializer. Always calls <a href="../trait.Visitor.html#method.visit_borrowed_bytes" title="method serde::de::Visitor::visit_borrowed_bytes"><code>Visitor::visit_borrowed_bytes</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.BorrowedStrDeserializer.html" title="struct serde::de::value::BorrowedStrDeserializer">Borrowed<wbr>StrDeserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>&str</code> with a lifetime tied to another
|
||||
deserializer.</div></li><li><div class="item-name"><a class="struct" href="struct.BytesDeserializer.html" title="struct serde::de::value::BytesDeserializer">Bytes<wbr>Deserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>&[u8]</code>. Always calls <a href="../trait.Visitor.html#method.visit_bytes" title="method serde::de::Visitor::visit_bytes"><code>Visitor::visit_bytes</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.CharDeserializer.html" title="struct serde::de::value::CharDeserializer">Char<wbr>Deserializer</a></div><div class="desc docblock-short">A deserializer holding
|
||||
a <code>char</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.CowStrDeserializer.html" title="struct serde::de::value::CowStrDeserializer">CowStr<wbr>Deserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>Cow<str></code>.</div></li><li><div class="item-name"><a class="struct" href="struct.EnumAccessDeserializer.html" title="struct serde::de::value::EnumAccessDeserializer">Enum<wbr>Access<wbr>Deserializer</a></div><div class="desc docblock-short">A deserializer holding an <code>EnumAccess</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.Error.html" title="struct serde::de::value::Error">Error</a></div><div class="desc docblock-short">A minimal representation of all possible errors that can occur using the
|
||||
<code>IntoDeserializer</code> trait.</div></li><li><div class="item-name"><a class="struct" href="struct.F32Deserializer.html" title="struct serde::de::value::F32Deserializer">F32Deserializer</a></div><div class="desc docblock-short">A deserializer holding
|
||||
an <code>f32</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.F64Deserializer.html" title="struct serde::de::value::F64Deserializer">F64Deserializer</a></div><div class="desc docblock-short">A deserializer holding
|
||||
an <code>f64</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.I8Deserializer.html" title="struct serde::de::value::I8Deserializer">I8Deserializer</a></div><div class="desc docblock-short">A deserializer holding
|
||||
an <code>i8</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.I16Deserializer.html" title="struct serde::de::value::I16Deserializer">I16Deserializer</a></div><div class="desc docblock-short">A deserializer holding
|
||||
an <code>i16</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.I32Deserializer.html" title="struct serde::de::value::I32Deserializer">I32Deserializer</a></div><div class="desc docblock-short">A deserializer holding
|
||||
an <code>i32</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.I64Deserializer.html" title="struct serde::de::value::I64Deserializer">I64Deserializer</a></div><div class="desc docblock-short">A deserializer holding
|
||||
an <code>i64</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.I128Deserializer.html" title="struct serde::de::value::I128Deserializer">I128<wbr>Deserializer</a></div><div class="desc docblock-short">A deserializer holding
|
||||
an <code>i128</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.IsizeDeserializer.html" title="struct serde::de::value::IsizeDeserializer">Isize<wbr>Deserializer</a></div><div class="desc docblock-short">A deserializer holding
|
||||
an <code>isize</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.MapAccessDeserializer.html" title="struct serde::de::value::MapAccessDeserializer">MapAccess<wbr>Deserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>MapAccess</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.MapDeserializer.html" title="struct serde::de::value::MapDeserializer">MapDeserializer</a></div><div class="desc docblock-short">A deserializer that iterates over a map.</div></li><li><div class="item-name"><a class="struct" href="struct.SeqAccessDeserializer.html" title="struct serde::de::value::SeqAccessDeserializer">SeqAccess<wbr>Deserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>SeqAccess</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.SeqDeserializer.html" title="struct serde::de::value::SeqDeserializer">SeqDeserializer</a></div><div class="desc docblock-short">A deserializer that iterates over a sequence.</div></li><li><div class="item-name"><a class="struct" href="struct.StrDeserializer.html" title="struct serde::de::value::StrDeserializer">StrDeserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>&str</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.StringDeserializer.html" title="struct serde::de::value::StringDeserializer">String<wbr>Deserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>String</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.U8Deserializer.html" title="struct serde::de::value::U8Deserializer">U8Deserializer</a></div><div class="desc docblock-short">A deserializer holding
|
||||
a <code>u8</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.U16Deserializer.html" title="struct serde::de::value::U16Deserializer">U16Deserializer</a></div><div class="desc docblock-short">A deserializer holding
|
||||
a <code>u16</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.U32Deserializer.html" title="struct serde::de::value::U32Deserializer">U32Deserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>u32</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.U64Deserializer.html" title="struct serde::de::value::U64Deserializer">U64Deserializer</a></div><div class="desc docblock-short">A deserializer holding
|
||||
a <code>u64</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.U128Deserializer.html" title="struct serde::de::value::U128Deserializer">U128<wbr>Deserializer</a></div><div class="desc docblock-short">A deserializer holding
|
||||
a <code>u128</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.UnitDeserializer.html" title="struct serde::de::value::UnitDeserializer">Unit<wbr>Deserializer</a></div><div class="desc docblock-short">A deserializer holding a <code>()</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.UsizeDeserializer.html" title="struct serde::de::value::UsizeDeserializer">Usize<wbr>Deserializer</a></div><div class="desc docblock-short">A deserializer holding
|
||||
a <code>usize</code>.</div></li></ul></section></div></main></body></html>
|
||||
1
serde/de/value/sidebar-items.js
Normal file
1
serde/de/value/sidebar-items.js
Normal 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"]};
|
||||
171
serde/de/value/struct.BoolDeserializer.html
Normal file
171
serde/de/value/struct.BoolDeserializer.html
Normal file
File diff suppressed because one or more lines are too long
172
serde/de/value/struct.BorrowedBytesDeserializer.html
Normal file
172
serde/de/value/struct.BorrowedBytesDeserializer.html
Normal file
File diff suppressed because one or more lines are too long
180
serde/de/value/struct.BorrowedStrDeserializer.html
Normal file
180
serde/de/value/struct.BorrowedStrDeserializer.html
Normal file
File diff suppressed because one or more lines are too long
171
serde/de/value/struct.BytesDeserializer.html
Normal file
171
serde/de/value/struct.BytesDeserializer.html
Normal file
File diff suppressed because one or more lines are too long
171
serde/de/value/struct.CharDeserializer.html
Normal file
171
serde/de/value/struct.CharDeserializer.html
Normal file
File diff suppressed because one or more lines are too long
178
serde/de/value/struct.CowStrDeserializer.html
Normal file
178
serde/de/value/struct.CowStrDeserializer.html
Normal file
File diff suppressed because one or more lines are too long
172
serde/de/value/struct.EnumAccessDeserializer.html
Normal file
172
serde/de/value/struct.EnumAccessDeserializer.html
Normal file
File diff suppressed because one or more lines are too long
28
serde/de/value/struct.Error.html
Normal file
28
serde/de/value/struct.Error.html
Normal file
File diff suppressed because one or more lines are too long
171
serde/de/value/struct.F32Deserializer.html
Normal file
171
serde/de/value/struct.F32Deserializer.html
Normal file
File diff suppressed because one or more lines are too long
171
serde/de/value/struct.F64Deserializer.html
Normal file
171
serde/de/value/struct.F64Deserializer.html
Normal file
File diff suppressed because one or more lines are too long
171
serde/de/value/struct.I128Deserializer.html
Normal file
171
serde/de/value/struct.I128Deserializer.html
Normal file
File diff suppressed because one or more lines are too long
171
serde/de/value/struct.I16Deserializer.html
Normal file
171
serde/de/value/struct.I16Deserializer.html
Normal file
File diff suppressed because one or more lines are too long
171
serde/de/value/struct.I32Deserializer.html
Normal file
171
serde/de/value/struct.I32Deserializer.html
Normal file
File diff suppressed because one or more lines are too long
171
serde/de/value/struct.I64Deserializer.html
Normal file
171
serde/de/value/struct.I64Deserializer.html
Normal file
File diff suppressed because one or more lines are too long
171
serde/de/value/struct.I8Deserializer.html
Normal file
171
serde/de/value/struct.I8Deserializer.html
Normal file
File diff suppressed because one or more lines are too long
171
serde/de/value/struct.IsizeDeserializer.html
Normal file
171
serde/de/value/struct.IsizeDeserializer.html
Normal file
File diff suppressed because one or more lines are too long
180
serde/de/value/struct.MapAccessDeserializer.html
Normal file
180
serde/de/value/struct.MapAccessDeserializer.html
Normal file
File diff suppressed because one or more lines are too long
238
serde/de/value/struct.MapDeserializer.html
Normal file
238
serde/de/value/struct.MapDeserializer.html
Normal file
File diff suppressed because one or more lines are too long
172
serde/de/value/struct.SeqAccessDeserializer.html
Normal file
172
serde/de/value/struct.SeqAccessDeserializer.html
Normal file
File diff suppressed because one or more lines are too long
198
serde/de/value/struct.SeqDeserializer.html
Normal file
198
serde/de/value/struct.SeqDeserializer.html
Normal file
File diff suppressed because one or more lines are too long
178
serde/de/value/struct.StrDeserializer.html
Normal file
178
serde/de/value/struct.StrDeserializer.html
Normal file
File diff suppressed because one or more lines are too long
178
serde/de/value/struct.StringDeserializer.html
Normal file
178
serde/de/value/struct.StringDeserializer.html
Normal file
File diff suppressed because one or more lines are too long
171
serde/de/value/struct.U128Deserializer.html
Normal file
171
serde/de/value/struct.U128Deserializer.html
Normal file
File diff suppressed because one or more lines are too long
171
serde/de/value/struct.U16Deserializer.html
Normal file
171
serde/de/value/struct.U16Deserializer.html
Normal file
File diff suppressed because one or more lines are too long
178
serde/de/value/struct.U32Deserializer.html
Normal file
178
serde/de/value/struct.U32Deserializer.html
Normal file
File diff suppressed because one or more lines are too long
171
serde/de/value/struct.U64Deserializer.html
Normal file
171
serde/de/value/struct.U64Deserializer.html
Normal file
File diff suppressed because one or more lines are too long
171
serde/de/value/struct.U8Deserializer.html
Normal file
171
serde/de/value/struct.U8Deserializer.html
Normal file
File diff suppressed because one or more lines are too long
167
serde/de/value/struct.UnitDeserializer.html
Normal file
167
serde/de/value/struct.UnitDeserializer.html
Normal file
File diff suppressed because one or more lines are too long
171
serde/de/value/struct.UsizeDeserializer.html
Normal file
171
serde/de/value/struct.UsizeDeserializer.html
Normal file
File diff suppressed because one or more lines are too long
7
serde/derive.Deserialize.html
Normal file
7
serde/derive.Deserialize.html
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<!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="Derive macro available if serde is built with `features = ["derive"]`."><title>Deserialize in serde - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc derive"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../serde/index.html">serde</a><span class="version">1.0.216</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">serde</a></span><h1>Derive Macro <span class="derive">Deserialize</span><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_derive/lib.rs.html#99">Source</a> </span></div><pre class="rust item-decl"><code>#[derive(Deserialize)]
|
||||
{
|
||||
<span class="comment">// Attributes available to this derive:</span>
|
||||
#[serde]
|
||||
}
|
||||
</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Derive macro available if serde is built with <code>features = ["derive"]</code>.</p>
|
||||
</div></details></section></div></main></body></html>
|
||||
7
serde/derive.Serialize.html
Normal file
7
serde/derive.Serialize.html
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<!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="Derive macro available if serde is built with `features = ["derive"]`."><title>Serialize in serde - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc derive"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../serde/index.html">serde</a><span class="version">1.0.216</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">serde</a></span><h1>Derive Macro <span class="derive">Serialize</span><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_derive/lib.rs.html#91">Source</a> </span></div><pre class="rust item-decl"><code>#[derive(Serialize)]
|
||||
{
|
||||
<span class="comment">// Attributes available to this derive:</span>
|
||||
#[serde]
|
||||
}
|
||||
</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Derive macro available if serde is built with <code>features = ["derive"]</code>.</p>
|
||||
</div></details></section></div></main></body></html>
|
||||
65
serde/index.html
Normal file
65
serde/index.html
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
<!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"><title>serde - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../serde/index.html">serde</a><span class="version">1.0.216</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="#">Sections</a></h3><ul class="block top-toc"><li><a href="#serde" title="Serde">Serde</a><ul><li><a href="#design" title="Design">Design</a></li><li><a href="#data-formats" title="Data formats">Data formats</a></li></ul></li></ul><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><li><a href="#derives" title="Derive Macros">Derive Macros</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>serde</span><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/lib.rs.html#1-348">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><h2 id="serde"><a class="doc-anchor" href="#serde">§</a>Serde</h2>
|
||||
<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 Serde ecosystem consists of data structures that know how to serialize
|
||||
and deserialize themselves along with data formats that know how to
|
||||
serialize and deserialize other things. Serde provides the layer by which
|
||||
these two groups interact with each other, allowing any supported data
|
||||
structure to be serialized and deserialized using any supported data format.</p>
|
||||
<p>See the Serde website <a href="https://serde.rs/">https://serde.rs/</a> for additional documentation and
|
||||
usage examples.</p>
|
||||
<h3 id="design"><a class="doc-anchor" href="#design">§</a>Design</h3>
|
||||
<p>Where many other languages rely on runtime reflection for serializing data,
|
||||
Serde is instead built on Rust’s powerful trait system. A data structure
|
||||
that knows how to serialize and deserialize itself is one that implements
|
||||
Serde’s <code>Serialize</code> and <code>Deserialize</code> traits (or uses Serde’s derive
|
||||
attribute to automatically generate implementations at compile time). This
|
||||
avoids any overhead of reflection or runtime type information. In fact in
|
||||
many situations the interaction between data structure and data format can
|
||||
be completely optimized away by the Rust compiler, leaving Serde
|
||||
serialization to perform the same speed as a handwritten serializer for the
|
||||
specific selection of data structure and data format.</p>
|
||||
<h3 id="data-formats"><a class="doc-anchor" href="#data-formats">§</a>Data formats</h3>
|
||||
<p>The following is a partial list of data formats that have been implemented
|
||||
for Serde by the community.</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/serde-rs/json">JSON</a>, the ubiquitous JavaScript Object Notation used by many HTTP APIs.</li>
|
||||
<li><a href="https://github.com/jamesmunns/postcard">Postcard</a>, a no_std and embedded-systems friendly compact binary format.</li>
|
||||
<li><a href="https://github.com/enarx/ciborium">CBOR</a>, a Concise Binary Object Representation designed for small message
|
||||
size without the need for version negotiation.</li>
|
||||
<li><a href="https://github.com/dtolnay/serde-yaml">YAML</a>, a self-proclaimed human-friendly configuration language that ain’t
|
||||
markup language.</li>
|
||||
<li><a href="https://github.com/3Hren/msgpack-rust">MessagePack</a>, an efficient binary format that resembles a compact JSON.</li>
|
||||
<li><a href="https://docs.rs/toml">TOML</a>, a minimal configuration format used by <a href="https://doc.rust-lang.org/cargo/reference/manifest.html">Cargo</a>.</li>
|
||||
<li><a href="https://github.com/birkenfeld/serde-pickle">Pickle</a>, a format common in the Python world.</li>
|
||||
<li><a href="https://github.com/ron-rs/ron">RON</a>, a Rusty Object Notation.</li>
|
||||
<li><a href="https://github.com/mongodb/bson-rust">BSON</a>, the data storage and network transfer format used by MongoDB.</li>
|
||||
<li><a href="https://docs.rs/apache-avro">Avro</a>, a binary format used within Apache Hadoop, with support for schema
|
||||
definition.</li>
|
||||
<li><a href="https://github.com/callum-oakley/json5-rs">JSON5</a>, a superset of JSON including some productions from ES5.</li>
|
||||
<li><a href="https://docs.rs/serde_qs">URL</a> query strings, in the x-www-form-urlencoded format.</li>
|
||||
<li><a href="https://github.com/dtolnay/serde-starlark">Starlark</a>, the format used for describing build targets by the Bazel and
|
||||
Buck build systems. <em>(serialization only)</em></li>
|
||||
<li><a href="https://github.com/softprops/envy">Envy</a>, a way to deserialize environment variables into Rust structs.
|
||||
<em>(deserialization only)</em></li>
|
||||
<li><a href="https://github.com/softprops/envy-store">Envy Store</a>, a way to deserialize <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html">AWS Parameter Store</a> parameters into
|
||||
Rust structs. <em>(deserialization only)</em></li>
|
||||
<li><a href="https://github.com/rotty/lexpr-rs">S-expressions</a>, the textual representation of code and data used by the
|
||||
Lisp language family.</li>
|
||||
<li><a href="https://docs.rs/zvariant">D-Bus</a>’s binary wire format.</li>
|
||||
<li><a href="https://github.com/google/flatbuffers/tree/master/rust/flexbuffers">FlexBuffers</a>, the schemaless cousin of Google’s FlatBuffers zero-copy
|
||||
serialization format.</li>
|
||||
<li><a href="https://github.com/P3KI/bendy">Bencode</a>, a simple binary format used in the BitTorrent protocol.</li>
|
||||
<li><a href="https://github.com/oxidecomputer/serde_tokenstream">Token streams</a>, for processing Rust procedural macro input.
|
||||
<em>(deserialization only)</em></li>
|
||||
<li><a href="https://docs.rs/serde_dynamo">DynamoDB Items</a>, the format used by <a href="https://docs.rs/rusoto_dynamodb">rusoto_dynamodb</a> to transfer data to
|
||||
and from DynamoDB.</li>
|
||||
<li><a href="https://github.com/Canop/deser-hjson">Hjson</a>, a syntax extension to JSON designed around human reading and
|
||||
editing. <em>(deserialization only)</em></li>
|
||||
<li><a href="https://docs.rs/csv">CSV</a>, Comma-separated values is a tabular text file format.</li>
|
||||
</ul>
|
||||
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="de/index.html" title="mod serde::de">de</a></div><div class="desc docblock-short">Generic data structure deserialization framework.</div></li><li><div class="item-name"><a class="mod" href="ser/index.html" title="mod serde::ser">ser</a></div><div class="desc docblock-short">Generic data structure serialization framework.</div></li></ul><h2 id="macros" class="section-header">Macros<a href="#macros" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="macro" href="macro.forward_to_deserialize_any.html" title="macro serde::forward_to_deserialize_any">forward_<wbr>to_<wbr>deserialize_<wbr>any</a></div><div class="desc docblock-short">Helper macro when implementing the <code>Deserializer</code> part of a new data format
|
||||
for Serde.</div></li></ul><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.Deserialize.html" title="trait serde::Deserialize">Deserialize</a></div><div class="desc docblock-short">A <strong>data structure</strong> that can be deserialized from any data format supported
|
||||
by Serde.</div></li><li><div class="item-name"><a class="trait" href="trait.Deserializer.html" title="trait serde::Deserializer">Deserializer</a></div><div class="desc docblock-short">A <strong>data format</strong> that can deserialize any data structure supported by
|
||||
Serde.</div></li><li><div class="item-name"><a class="trait" href="trait.Serialize.html" title="trait serde::Serialize">Serialize</a></div><div class="desc docblock-short">A <strong>data structure</strong> that can be serialized into any data format supported
|
||||
by Serde.</div></li><li><div class="item-name"><a class="trait" href="trait.Serializer.html" title="trait serde::Serializer">Serializer</a></div><div class="desc docblock-short">A <strong>data format</strong> that can serialize any data structure supported by Serde.</div></li></ul><h2 id="derives" class="section-header">Derive Macros<a href="#derives" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="derive" href="derive.Deserialize.html" title="derive serde::Deserialize">Deserialize</a></div><div class="desc docblock-short">Derive macro available if serde is built with <code>features = ["derive"]</code>.</div></li><li><div class="item-name"><a class="derive" href="derive.Serialize.html" title="derive serde::Serialize">Serialize</a></div><div class="desc docblock-short">Derive macro available if serde is built with <code>features = ["derive"]</code>.</div></li></ul></section></div></main></body></html>
|
||||
11
serde/macro.forward_to_deserialize_any!.html
Normal file
11
serde/macro.forward_to_deserialize_any!.html
Normal 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>
|
||||
48
serde/macro.forward_to_deserialize_any.html
Normal file
48
serde/macro.forward_to_deserialize_any.html
Normal 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="Helper macro when implementing the `Deserializer` part of a new data format for Serde."><title>forward_to_deserialize_any in serde - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../serde/index.html">serde</a><span class="version">1.0.216</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">serde</a></span><h1>Macro <span class="macro">forward_to_deserialize_any</span><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/macros.rs.html#111-119">Source</a> </span></div><pre class="rust item-decl"><code>macro_rules! forward_to_deserialize_any {
|
||||
(<$visitor:ident: Visitor<$lifetime:tt>> $($func:ident)*) => { ... };
|
||||
($($func:ident)*) => { ... };
|
||||
}</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"><code>Deserializer</code></a> implementations for self-describing formats do not
|
||||
care what hint the <a href="de/trait.Visitor.html"><code>Visitor</code></a> gives them, they just want to blindly call
|
||||
the <a href="de/trait.Visitor.html"><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"><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<V>(<span class="self">self</span>, visitor: V) -> <span class="prelude-ty">Result</span><V::Value, <span class="self">Self</span>::Error>
|
||||
<span class="kw">where
|
||||
</span>V: Visitor<<span class="lifetime">'de</span>>,
|
||||
{
|
||||
<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"><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><<span class="lifetime">'de</span>> Deserializer<<span class="lifetime">'de</span>> <span class="kw">for </span>MyDeserializer {
|
||||
<span class="kw">fn </span>deserialize_any<V>(<span class="self">self</span>, visitor: V) -> <span class="prelude-ty">Result</span><V::Value, <span class="self">Self</span>::Error>
|
||||
<span class="kw">where
|
||||
</span>V: Visitor<<span class="lifetime">'de</span>>,
|
||||
{
|
||||
<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> {
|
||||
<W: Visitor<<span class="lifetime">'q</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>
|
||||
</div></details></section></div></main></body></html>
|
||||
11
serde/ser/impossible/struct.Impossible.html
Normal file
11
serde/ser/impossible/struct.Impossible.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../serde/ser/struct.Impossible.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../serde/ser/struct.Impossible.html">../../../serde/ser/struct.Impossible.html</a>...</p>
|
||||
<script>location.replace("../../../serde/ser/struct.Impossible.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
117
serde/ser/index.html
Normal file
117
serde/ser/index.html
Normal 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::ser - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde/index.html">serde</a><span class="version">1.0.216</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</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">serde</a></span><h1>Module <span>ser</span><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/ser/mod.rs.html#1-1954">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"><code>Serialize</code></a> and
|
||||
<a href="../trait.Serializer.html"><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"><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"><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"><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"><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<K, V></code></a> type that is serializable by Serde because the crate
|
||||
provides an implementation of <a href="../trait.Serialize.html"><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"><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>&T and &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<T></li>
|
||||
<li>Result<T, E></li>
|
||||
<li>PhantomData<T></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Wrapper types</strong>:
|
||||
<ul>
|
||||
<li>Box<T></li>
|
||||
<li>Cow<’a, T></li>
|
||||
<li>Cell<T></li>
|
||||
<li>RefCell<T></li>
|
||||
<li>Mutex<T></li>
|
||||
<li>RwLock<T></li>
|
||||
<li>Rc<T> <em>(if</em> features = [“rc”] <em>is enabled)</em></li>
|
||||
<li>Arc<T> <em>(if</em> features = [“rc”] <em>is enabled)</em></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Collection types</strong>:
|
||||
<ul>
|
||||
<li>BTreeMap<K, V></li>
|
||||
<li>BTreeSet<T></li>
|
||||
<li>BinaryHeap<T></li>
|
||||
<li>HashMap<K, V, H></li>
|
||||
<li>HashSet<T, H></li>
|
||||
<li>LinkedList<T></li>
|
||||
<li>VecDeque<T></li>
|
||||
<li>Vec<T></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<T></li>
|
||||
<li>RangeInclusive<T></li>
|
||||
<li>Bound<T></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><ul class="item-table"><li><div class="item-name" id="reexport.StdError"><code>pub use std::error::<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/error/trait.Error.html" title="trait core::error::Error">Error</a> as StdError;</code></div></li></ul><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Impossible.html" title="struct serde::ser::Impossible">Impossible</a></div><div class="desc docblock-short">Helper type for implementing a <code>Serializer</code> that does not support
|
||||
serializing one of the compound types.</div></li></ul><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.Error.html" title="trait serde::ser::Error">Error</a></div><div class="desc docblock-short">Trait used by <code>Serialize</code> implementations to generically construct
|
||||
errors belonging to the <code>Serializer</code> against which they are
|
||||
currently running.</div></li><li><div class="item-name"><a class="trait" href="trait.Serialize.html" title="trait serde::ser::Serialize">Serialize</a></div><div class="desc docblock-short">A <strong>data structure</strong> that can be serialized into any data format supported
|
||||
by Serde.</div></li><li><div class="item-name"><a class="trait" href="trait.SerializeMap.html" title="trait serde::ser::SerializeMap">Serialize<wbr>Map</a></div><div class="desc docblock-short">Returned from <code>Serializer::serialize_map</code>.</div></li><li><div class="item-name"><a class="trait" href="trait.SerializeSeq.html" title="trait serde::ser::SerializeSeq">Serialize<wbr>Seq</a></div><div class="desc docblock-short">Returned from <code>Serializer::serialize_seq</code>.</div></li><li><div class="item-name"><a class="trait" href="trait.SerializeStruct.html" title="trait serde::ser::SerializeStruct">Serialize<wbr>Struct</a></div><div class="desc docblock-short">Returned from <code>Serializer::serialize_struct</code>.</div></li><li><div class="item-name"><a class="trait" href="trait.SerializeStructVariant.html" title="trait serde::ser::SerializeStructVariant">Serialize<wbr>Struct<wbr>Variant</a></div><div class="desc docblock-short">Returned from <code>Serializer::serialize_struct_variant</code>.</div></li><li><div class="item-name"><a class="trait" href="trait.SerializeTuple.html" title="trait serde::ser::SerializeTuple">Serialize<wbr>Tuple</a></div><div class="desc docblock-short">Returned from <code>Serializer::serialize_tuple</code>.</div></li><li><div class="item-name"><a class="trait" href="trait.SerializeTupleStruct.html" title="trait serde::ser::SerializeTupleStruct">Serialize<wbr>Tuple<wbr>Struct</a></div><div class="desc docblock-short">Returned from <code>Serializer::serialize_tuple_struct</code>.</div></li><li><div class="item-name"><a class="trait" href="trait.SerializeTupleVariant.html" title="trait serde::ser::SerializeTupleVariant">Serialize<wbr>Tuple<wbr>Variant</a></div><div class="desc docblock-short">Returned from <code>Serializer::serialize_tuple_variant</code>.</div></li><li><div class="item-name"><a class="trait" href="trait.Serializer.html" title="trait serde::ser::Serializer">Serializer</a></div><div class="desc docblock-short">A <strong>data format</strong> that can serialize any data structure supported by Serde.</div></li></ul></section></div></main></body></html>
|
||||
1
serde/ser/sidebar-items.js
Normal file
1
serde/ser/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"struct":["Impossible"],"trait":["Error","Serialize","SerializeMap","SerializeSeq","SerializeStruct","SerializeStructVariant","SerializeTuple","SerializeTupleStruct","SerializeTupleVariant","Serializer"]};
|
||||
75
serde/ser/struct.Impossible.html
Normal file
75
serde/ser/struct.Impossible.html
Normal file
File diff suppressed because one or more lines are too long
32
serde/ser/trait.Error.html
Normal file
32
serde/ser/trait.Error.html
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<!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::ser - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde/index.html">serde</a><span class="version">1.0.216</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>ser</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">serde</a>::<wbr><a href="index.html">ser</a></span><h1>Trait <span class="trait">Error</span><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/ser/mod.rs.html#186">Source</a> </span></div><pre class="rust item-decl"><code>pub trait Error: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/error/trait.Error.html" title="trait core::error::Error">StdError</a> {
|
||||
// Required method
|
||||
fn <a href="#tymethod.custom" class="fn">custom</a><T>(msg: T) -> Self
|
||||
<span class="where">where T: <a class="trait" href="https://doc.rust-lang.org/1.84.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/ser/mod.rs.html#186">Source</a><h4 class="code-header">fn <a href="#tymethod.custom" class="fn">custom</a><T>(msg: T) -> Self<div class="where">where
|
||||
T: <a class="trait" href="https://doc.rust-lang.org/1.84.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"><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/std/path/struct.Path.html"><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<S>(<span class="kw-2">&</span><span class="self">self</span>, serializer: S) -> <span class="prelude-ty">Result</span><S::Ok, S::Error>
|
||||
<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) => serializer.serialize_str(s),
|
||||
<span class="prelude-val">None </span>=> <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.84.1/reference/items/traits.html#object-safety">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/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::ser::Error">Error</a> for <a class="struct" href="https://doc.rust-lang.org/1.84.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/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><T: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>>(_msg: T) -> 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/de/value.rs.html#83-91">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::ser::Error">Error</a> for serde::de::value::<a class="struct" href="../de/value/struct.Error.html" title="struct serde::de::value::Error">Error</a></h3></section></div><script src="../../trait.impl/serde/ser/trait.Error.js" data-ignore-extern-crates="core" async></script></section></div></main></body></html>
|
||||
399
serde/ser/trait.Serialize.html
Normal file
399
serde/ser/trait.Serialize.html
Normal file
File diff suppressed because one or more lines are too long
75
serde/ser/trait.SerializeMap.html
Normal file
75
serde/ser/trait.SerializeMap.html
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<!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::ser - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde/index.html">serde</a><span class="version">1.0.216</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>ser</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">serde</a>::<wbr><a href="index.html">ser</a></span><h1>Trait <span class="trait">SerializeMap</span><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/ser/mod.rs.html#1767-1822">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::ser::Error">Error</a>;
|
||||
|
||||
// Required methods
|
||||
fn <a href="#tymethod.serialize_key" class="fn">serialize_key</a><T>(&mut self, key: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Error" title="type serde::ser::SerializeMap::Error">Error</a>>
|
||||
<span class="where">where T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::Serialize">Serialize</a></span>;
|
||||
<span class="item-spacer"></span> fn <a href="#tymethod.serialize_value" class="fn">serialize_value</a><T>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Error" title="type serde::ser::SerializeMap::Error">Error</a>>
|
||||
<span class="where">where T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::Serialize">Serialize</a></span>;
|
||||
<span class="item-spacer"></span> fn <a href="#tymethod.end" class="fn">end</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Ok" title="type serde::ser::SerializeMap::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Error" title="type serde::ser::SerializeMap::Error">Error</a>>;
|
||||
|
||||
// Provided method
|
||||
fn <a href="#method.serialize_entry" class="fn">serialize_entry</a><K, V>(
|
||||
&mut self,
|
||||
key: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&K</a>,
|
||||
value: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&V</a>,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Error" title="type serde::ser::SerializeMap::Error">Error</a>>
|
||||
<span class="where">where K: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::Serialize">Serialize</a>,
|
||||
V: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::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><K, V> Serialize <span class="kw">for </span>HashMap<K, V>
|
||||
<span class="kw">where
|
||||
</span>K: Serialize,
|
||||
V: Serialize,
|
||||
{
|
||||
<span class="kw">fn </span>serialize<S>(<span class="kw-2">&</span><span class="self">self</span>, serializer: S) -> <span class="prelude-ty">Result</span><S::Ok, S::Error>
|
||||
<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/ser/mod.rs.html#1769">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/ser/mod.rs.html#1772">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::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/ser/mod.rs.html#1780-1782">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_key" class="fn">serialize_key</a><T>(&mut self, key: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Error" title="type serde::ser::SerializeMap::Error">Error</a>><div class="where">where
|
||||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::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/ser/mod.rs.html#1790-1792">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_value" class="fn">serialize_value</a><T>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Error" title="type serde::ser::SerializeMap::Error">Error</a>><div class="where">where
|
||||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::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/ser/mod.rs.html#1821">Source</a><h4 class="code-header">fn <a href="#tymethod.end" class="fn">end</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Ok" title="type serde::ser::SerializeMap::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Error" title="type serde::ser::SerializeMap::Error">Error</a>></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/ser/mod.rs.html#1811-1818">Source</a><h4 class="code-header">fn <a href="#method.serialize_entry" class="fn">serialize_entry</a><K, V>(
|
||||
&mut self,
|
||||
key: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&K</a>,
|
||||
value: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&V</a>,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeMap.html#associatedtype.Error" title="type serde::ser::SerializeMap::Error">Error</a>><div class="where">where
|
||||
K: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::Serialize">Serialize</a>,
|
||||
V: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::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"><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="#tymethod.serialize_key"><code>serialize_key</code></a> and <a href="#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"><code>Serialize</code></a> implementations
|
||||
are encouraged to use <code>serialize_entry</code> if possible.</p>
|
||||
<p>The default implementation delegates to <a href="#tymethod.serialize_key"><code>serialize_key</code></a> and
|
||||
<a href="#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.84.1/reference/items/traits.html#object-safety">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/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<Ok, Error> <a class="trait" href="trait.SerializeMap.html" title="trait serde::ser::SerializeMap">SerializeMap</a> for <a class="struct" href="struct.Impossible.html" title="struct serde::ser::Impossible">Impossible</a><Ok, Error><div class="where">where
|
||||
Error: <a class="trait" href="trait.Error.html" title="trait serde::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/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/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/ser/trait.SerializeMap.js" async></script></section></div></main></body></html>
|
||||
37
serde/ser/trait.SerializeSeq.html
Normal file
37
serde/ser/trait.SerializeSeq.html
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<!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::ser - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde/index.html">serde</a><span class="version">1.0.216</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>ser</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">serde</a>::<wbr><a href="index.html">ser</a></span><h1>Trait <span class="trait">SerializeSeq</span><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/ser/mod.rs.html#1498-1512">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::ser::Error">Error</a>;
|
||||
|
||||
// Required methods
|
||||
fn <a href="#tymethod.serialize_element" class="fn">serialize_element</a><T>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeSeq.html#associatedtype.Error" title="type serde::ser::SerializeSeq::Error">Error</a>>
|
||||
<span class="where">where T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::Serialize">Serialize</a></span>;
|
||||
<span class="item-spacer"></span> fn <a href="#tymethod.end" class="fn">end</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.SerializeSeq.html#associatedtype.Ok" title="type serde::ser::SerializeSeq::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeSeq.html#associatedtype.Error" title="type serde::ser::SerializeSeq::Error">Error</a>>;
|
||||
}</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><T> Serialize <span class="kw">for </span>Vec<T>
|
||||
<span class="kw">where
|
||||
</span>T: Serialize,
|
||||
{
|
||||
<span class="kw">fn </span>serialize<S>(<span class="kw-2">&</span><span class="self">self</span>, serializer: S) -> <span class="prelude-ty">Result</span><S::Ok, S::Error>
|
||||
<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/ser/mod.rs.html#1500">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/ser/mod.rs.html#1503">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::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/ser/mod.rs.html#1506-1508">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_element" class="fn">serialize_element</a><T>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeSeq.html#associatedtype.Error" title="type serde::ser::SerializeSeq::Error">Error</a>><div class="where">where
|
||||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::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/ser/mod.rs.html#1511">Source</a><h4 class="code-header">fn <a href="#tymethod.end" class="fn">end</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.SerializeSeq.html#associatedtype.Ok" title="type serde::ser::SerializeSeq::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeSeq.html#associatedtype.Error" title="type serde::ser::SerializeSeq::Error">Error</a>></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.84.1/reference/items/traits.html#object-safety">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/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<Ok, Error> <a class="trait" href="trait.SerializeSeq.html" title="trait serde::ser::SerializeSeq">SerializeSeq</a> for <a class="struct" href="struct.Impossible.html" title="struct serde::ser::Impossible">Impossible</a><Ok, Error><div class="where">where
|
||||
Error: <a class="trait" href="trait.Error.html" title="trait serde::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/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/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/ser/trait.SerializeSeq.js" async></script></section></div></main></body></html>
|
||||
53
serde/ser/trait.SerializeStruct.html
Normal file
53
serde/ser/trait.SerializeStruct.html
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Returned from `Serializer::serialize_struct`."><title>SerializeStruct in serde::ser - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde/index.html">serde</a><span class="version">1.0.216</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>ser</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">serde</a>::<wbr><a href="index.html">ser</a></span><h1>Trait <span class="trait">SerializeStruct</span><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/ser/mod.rs.html#1857-1880">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::ser::Error">Error</a>;
|
||||
|
||||
// Required methods
|
||||
fn <a href="#tymethod.serialize_field" class="fn">serialize_field</a><T>(
|
||||
&mut self,
|
||||
key: &'static <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>,
|
||||
value: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&T</a>,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeStruct.html#associatedtype.Error" title="type serde::ser::SerializeStruct::Error">Error</a>>
|
||||
<span class="where">where T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::Serialize">Serialize</a></span>;
|
||||
<span class="item-spacer"></span> fn <a href="#tymethod.end" class="fn">end</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.SerializeStruct.html#associatedtype.Ok" title="type serde::ser::SerializeStruct::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeStruct.html#associatedtype.Error" title="type serde::ser::SerializeStruct::Error">Error</a>>;
|
||||
|
||||
// Provided method
|
||||
fn <a href="#method.skip_field" class="fn">skip_field</a>(&mut self, key: &'static <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeStruct.html#associatedtype.Error" title="type serde::ser::SerializeStruct::Error">Error</a>> { ... }
|
||||
}</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<S>(<span class="kw-2">&</span><span class="self">self</span>, serializer: S) -> <span class="prelude-ty">Result</span><S::Ok, S::Error>
|
||||
<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">&</span><span class="self">self</span>.r)<span class="question-mark">?</span>;
|
||||
rgb.serialize_field(<span class="string">"g"</span>, <span class="kw-2">&</span><span class="self">self</span>.g)<span class="question-mark">?</span>;
|
||||
rgb.serialize_field(<span class="string">"b"</span>, <span class="kw-2">&</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/ser/mod.rs.html#1859">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/ser/mod.rs.html#1862">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::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/ser/mod.rs.html#1865-1867">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_field" class="fn">serialize_field</a><T>(
|
||||
&mut self,
|
||||
key: &'static <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>,
|
||||
value: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&T</a>,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeStruct.html#associatedtype.Error" title="type serde::ser::SerializeStruct::Error">Error</a>><div class="where">where
|
||||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::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/ser/mod.rs.html#1879">Source</a><h4 class="code-header">fn <a href="#tymethod.end" class="fn">end</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.SerializeStruct.html#associatedtype.Ok" title="type serde::ser::SerializeStruct::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeStruct.html#associatedtype.Error" title="type serde::ser::SerializeStruct::Error">Error</a>></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/ser/mod.rs.html#1873-1876">Source</a><h4 class="code-header">fn <a href="#method.skip_field" class="fn">skip_field</a>(&mut self, key: &'static <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeStruct.html#associatedtype.Error" title="type serde::ser::SerializeStruct::Error">Error</a>></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.84.1/reference/items/traits.html#object-safety">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/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<Ok, Error> <a class="trait" href="trait.SerializeStruct.html" title="trait serde::ser::SerializeStruct">SerializeStruct</a> for <a class="struct" href="struct.Impossible.html" title="struct serde::ser::Impossible">Impossible</a><Ok, Error><div class="where">where
|
||||
Error: <a class="trait" href="trait.Error.html" title="trait serde::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/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/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/ser/trait.SerializeStruct.js" async></script></section></div></main></body></html>
|
||||
59
serde/ser/trait.SerializeStructVariant.html
Normal file
59
serde/ser/trait.SerializeStructVariant.html
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<!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::ser - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde/index.html">serde</a><span class="version">1.0.216</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>ser</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">serde</a>::<wbr><a href="index.html">ser</a></span><h1>Trait <span class="trait">SerializeStructVariant</span><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/ser/mod.rs.html#1921-1944">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::ser::Error">Error</a>;
|
||||
|
||||
// Required methods
|
||||
fn <a href="#tymethod.serialize_field" class="fn">serialize_field</a><T>(
|
||||
&mut self,
|
||||
key: &'static <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>,
|
||||
value: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&T</a>,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeStructVariant.html#associatedtype.Error" title="type serde::ser::SerializeStructVariant::Error">Error</a>>
|
||||
<span class="where">where T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::Serialize">Serialize</a></span>;
|
||||
<span class="item-spacer"></span> fn <a href="#tymethod.end" class="fn">end</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.SerializeStructVariant.html#associatedtype.Ok" title="type serde::ser::SerializeStructVariant::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeStructVariant.html#associatedtype.Error" title="type serde::ser::SerializeStructVariant::Error">Error</a>>;
|
||||
|
||||
// Provided method
|
||||
fn <a href="#method.skip_field" class="fn">skip_field</a>(&mut self, key: &'static <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeStructVariant.html#associatedtype.Error" title="type serde::ser::SerializeStructVariant::Error">Error</a>> { ... }
|
||||
}</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<S>(<span class="kw-2">&</span><span class="self">self</span>, serializer: S) -> <span class="prelude-ty">Result</span><S::Ok, S::Error>
|
||||
<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,
|
||||
} => {
|
||||
<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/ser/mod.rs.html#1923">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/ser/mod.rs.html#1926">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::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/ser/mod.rs.html#1929-1931">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_field" class="fn">serialize_field</a><T>(
|
||||
&mut self,
|
||||
key: &'static <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>,
|
||||
value: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&T</a>,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeStructVariant.html#associatedtype.Error" title="type serde::ser::SerializeStructVariant::Error">Error</a>><div class="where">where
|
||||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::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/ser/mod.rs.html#1943">Source</a><h4 class="code-header">fn <a href="#tymethod.end" class="fn">end</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.SerializeStructVariant.html#associatedtype.Ok" title="type serde::ser::SerializeStructVariant::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeStructVariant.html#associatedtype.Error" title="type serde::ser::SerializeStructVariant::Error">Error</a>></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/ser/mod.rs.html#1937-1940">Source</a><h4 class="code-header">fn <a href="#method.skip_field" class="fn">skip_field</a>(&mut self, key: &'static <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeStructVariant.html#associatedtype.Error" title="type serde::ser::SerializeStructVariant::Error">Error</a>></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.84.1/reference/items/traits.html#object-safety">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/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<Ok, Error> <a class="trait" href="trait.SerializeStructVariant.html" title="trait serde::ser::SerializeStructVariant">SerializeStructVariant</a> for <a class="struct" href="struct.Impossible.html" title="struct serde::ser::Impossible">Impossible</a><Ok, Error><div class="where">where
|
||||
Error: <a class="trait" href="trait.Error.html" title="trait serde::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/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/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/ser/trait.SerializeStructVariant.js" async></script></section></div></main></body></html>
|
||||
57
serde/ser/trait.SerializeTuple.html
Normal file
57
serde/ser/trait.SerializeTuple.html
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<!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::ser - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde/index.html">serde</a><span class="version">1.0.216</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>ser</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">serde</a>::<wbr><a href="index.html">ser</a></span><h1>Trait <span class="trait">SerializeTuple</span><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/ser/mod.rs.html#1598-1612">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::ser::Error">Error</a>;
|
||||
|
||||
// Required methods
|
||||
fn <a href="#tymethod.serialize_element" class="fn">serialize_element</a><T>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeTuple.html#associatedtype.Error" title="type serde::ser::SerializeTuple::Error">Error</a>>
|
||||
<span class="where">where T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::Serialize">Serialize</a></span>;
|
||||
<span class="item-spacer"></span> fn <a href="#tymethod.end" class="fn">end</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.SerializeTuple.html#associatedtype.Ok" title="type serde::ser::SerializeTuple::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeTuple.html#associatedtype.Error" title="type serde::ser::SerializeTuple::Error">Error</a>>;
|
||||
}</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><A, B, C> 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<S>(<span class="kw-2">&</span><span class="self">self</span>, serializer: S) -> <span class="prelude-ty">Result</span><S::Ok, S::Error>
|
||||
<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">&</span><span class="self">self</span>.<span class="number">0</span>)<span class="question-mark">?</span>;
|
||||
tup.serialize_element(<span class="kw-2">&</span><span class="self">self</span>.<span class="number">1</span>)<span class="question-mark">?</span>;
|
||||
tup.serialize_element(<span class="kw-2">&</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><T> 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<S>(<span class="kw-2">&</span><span class="self">self</span>, serializer: S) -> <span class="prelude-ty">Result</span><S::Ok, S::Error>
|
||||
<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/ser/mod.rs.html#1600">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/ser/mod.rs.html#1603">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::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/ser/mod.rs.html#1606-1608">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_element" class="fn">serialize_element</a><T>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeTuple.html#associatedtype.Error" title="type serde::ser::SerializeTuple::Error">Error</a>><div class="where">where
|
||||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::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/ser/mod.rs.html#1611">Source</a><h4 class="code-header">fn <a href="#tymethod.end" class="fn">end</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.SerializeTuple.html#associatedtype.Ok" title="type serde::ser::SerializeTuple::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeTuple.html#associatedtype.Error" title="type serde::ser::SerializeTuple::Error">Error</a>></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.84.1/reference/items/traits.html#object-safety">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/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<Ok, Error> <a class="trait" href="trait.SerializeTuple.html" title="trait serde::ser::SerializeTuple">SerializeTuple</a> for <a class="struct" href="struct.Impossible.html" title="struct serde::ser::Impossible">Impossible</a><Ok, Error><div class="where">where
|
||||
Error: <a class="trait" href="trait.Error.html" title="trait serde::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/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/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/ser/trait.SerializeTuple.js" async></script></section></div></main></body></html>
|
||||
36
serde/ser/trait.SerializeTupleStruct.html
Normal file
36
serde/ser/trait.SerializeTupleStruct.html
Normal 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_tuple_struct`."><title>SerializeTupleStruct in serde::ser - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde/index.html">serde</a><span class="version">1.0.216</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>ser</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">serde</a>::<wbr><a href="index.html">ser</a></span><h1>Trait <span class="trait">SerializeTupleStruct</span><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/ser/mod.rs.html#1643-1657">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::ser::Error">Error</a>;
|
||||
|
||||
// Required methods
|
||||
fn <a href="#tymethod.serialize_field" class="fn">serialize_field</a><T>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeTupleStruct.html#associatedtype.Error" title="type serde::ser::SerializeTupleStruct::Error">Error</a>>
|
||||
<span class="where">where T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::Serialize">Serialize</a></span>;
|
||||
<span class="item-spacer"></span> fn <a href="#tymethod.end" class="fn">end</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.SerializeTupleStruct.html#associatedtype.Ok" title="type serde::ser::SerializeTupleStruct::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeTupleStruct.html#associatedtype.Error" title="type serde::ser::SerializeTupleStruct::Error">Error</a>>;
|
||||
}</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<S>(<span class="kw-2">&</span><span class="self">self</span>, serializer: S) -> <span class="prelude-ty">Result</span><S::Ok, S::Error>
|
||||
<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">&</span><span class="self">self</span>.<span class="number">0</span>)<span class="question-mark">?</span>;
|
||||
ts.serialize_field(<span class="kw-2">&</span><span class="self">self</span>.<span class="number">1</span>)<span class="question-mark">?</span>;
|
||||
ts.serialize_field(<span class="kw-2">&</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/ser/mod.rs.html#1645">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/ser/mod.rs.html#1648">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::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/ser/mod.rs.html#1651-1653">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_field" class="fn">serialize_field</a><T>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeTupleStruct.html#associatedtype.Error" title="type serde::ser::SerializeTupleStruct::Error">Error</a>><div class="where">where
|
||||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::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/ser/mod.rs.html#1656">Source</a><h4 class="code-header">fn <a href="#tymethod.end" class="fn">end</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.SerializeTupleStruct.html#associatedtype.Ok" title="type serde::ser::SerializeTupleStruct::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeTupleStruct.html#associatedtype.Error" title="type serde::ser::SerializeTupleStruct::Error">Error</a>></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.84.1/reference/items/traits.html#object-safety">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/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<Ok, Error> <a class="trait" href="trait.SerializeTupleStruct.html" title="trait serde::ser::SerializeTupleStruct">SerializeTupleStruct</a> for <a class="struct" href="struct.Impossible.html" title="struct serde::ser::Impossible">Impossible</a><Ok, Error><div class="where">where
|
||||
Error: <a class="trait" href="trait.Error.html" title="trait serde::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/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/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/ser/trait.SerializeTupleStruct.js" async></script></section></div></main></body></html>
|
||||
49
serde/ser/trait.SerializeTupleVariant.html
Normal file
49
serde/ser/trait.SerializeTupleVariant.html
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<!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::ser - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="serde" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../serde/index.html">serde</a><span class="version">1.0.216</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>ser</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">serde</a>::<wbr><a href="index.html">ser</a></span><h1>Trait <span class="trait">SerializeTupleVariant</span><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/ser/mod.rs.html#1701-1715">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::ser::Error">Error</a>;
|
||||
|
||||
// Required methods
|
||||
fn <a href="#tymethod.serialize_field" class="fn">serialize_field</a><T>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeTupleVariant.html#associatedtype.Error" title="type serde::ser::SerializeTupleVariant::Error">Error</a>>
|
||||
<span class="where">where T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::Serialize">Serialize</a></span>;
|
||||
<span class="item-spacer"></span> fn <a href="#tymethod.end" class="fn">end</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.SerializeTupleVariant.html#associatedtype.Ok" title="type serde::ser::SerializeTupleVariant::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeTupleVariant.html#associatedtype.Error" title="type serde::ser::SerializeTupleVariant::Error">Error</a>>;
|
||||
}</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<S>(<span class="kw-2">&</span><span class="self">self</span>, serializer: S) -> <span class="prelude-ty">Result</span><S::Ok, S::Error>
|
||||
<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) => {
|
||||
<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) => {
|
||||
<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/ser/mod.rs.html#1703">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/ser/mod.rs.html#1706">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::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/ser/mod.rs.html#1709-1711">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_field" class="fn">serialize_field</a><T>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.SerializeTupleVariant.html#associatedtype.Error" title="type serde::ser::SerializeTupleVariant::Error">Error</a>><div class="where">where
|
||||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../trait.Serialize.html" title="trait serde::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/ser/mod.rs.html#1714">Source</a><h4 class="code-header">fn <a href="#tymethod.end" class="fn">end</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.SerializeTupleVariant.html#associatedtype.Ok" title="type serde::ser::SerializeTupleVariant::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.SerializeTupleVariant.html#associatedtype.Error" title="type serde::ser::SerializeTupleVariant::Error">Error</a>></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.84.1/reference/items/traits.html#object-safety">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/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<Ok, Error> <a class="trait" href="trait.SerializeTupleVariant.html" title="trait serde::ser::SerializeTupleVariant">SerializeTupleVariant</a> for <a class="struct" href="struct.Impossible.html" title="struct serde::ser::Impossible">Impossible</a><Ok, Error><div class="where">where
|
||||
Error: <a class="trait" href="trait.Error.html" title="trait serde::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/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/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/ser/trait.SerializeTupleVariant.js" async></script></section></div></main></body></html>
|
||||
952
serde/ser/trait.Serializer.html
Normal file
952
serde/ser/trait.Serializer.html
Normal file
File diff suppressed because one or more lines are too long
1
serde/sidebar-items.js
Normal file
1
serde/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"derive":["Deserialize","Serialize"],"macro":["forward_to_deserialize_any"],"mod":["de","ser"],"trait":["Deserialize","Deserializer","Serialize","Serializer"]};
|
||||
389
serde/trait.Deserialize.html
Normal file
389
serde/trait.Deserialize.html
Normal file
File diff suppressed because one or more lines are too long
451
serde/trait.Deserializer.html
Normal file
451
serde/trait.Deserializer.html
Normal file
File diff suppressed because one or more lines are too long
399
serde/trait.Serialize.html
Normal file
399
serde/trait.Serialize.html
Normal file
File diff suppressed because one or more lines are too long
952
serde/trait.Serializer.html
Normal file
952
serde/trait.Serializer.html
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue