197 lines
231 KiB
HTML
197 lines
231 KiB
HTML
|
<!DOCTYPE html>
|
|||
|
<html lang="en">
|
|||
|
<head>
|
|||
|
<meta charset="utf-8">
|
|||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|||
|
<meta name="generator" content="rustdoc">
|
|||
|
<meta name="description" content="API documentation for the Rust `Serialize` trait in crate `serde`.">
|
|||
|
<meta name="keywords" content="rust, rustlang, rust-lang, Serialize">
|
|||
|
|
|||
|
<title>serde::Serialize - Rust</title>
|
|||
|
|
|||
|
<link rel="stylesheet" type="text/css" href="../normalize.css">
|
|||
|
<link rel="stylesheet" type="text/css" href="../rustdoc.css"
|
|||
|
id="mainThemeStyle">
|
|||
|
|
|||
|
<link rel="stylesheet" type="text/css" href="../dark.css">
|
|||
|
<link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle">
|
|||
|
<script src="../storage.js"></script>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
</head>
|
|||
|
<body class="rustdoc trait">
|
|||
|
<!--[if lte IE 8]>
|
|||
|
<div class="warning">
|
|||
|
This old browser is unsupported and will most likely display funky
|
|||
|
things.
|
|||
|
</div>
|
|||
|
<![endif]-->
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<nav class="sidebar">
|
|||
|
<div class="sidebar-menu">☰</div>
|
|||
|
|
|||
|
<p class='location'>Trait Serialize</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.serialize">serialize</a></div><a class="sidebar-title" href="#foreign-impls">Implementations on Foreign Types</a><div class="sidebar-links"><a href="#impl-Serialize">bool</a><a href="#impl-Serialize">isize</a><a href="#impl-Serialize">i8</a><a href="#impl-Serialize">i16</a><a href="#impl-Serialize">i32</a><a href="#impl-Serialize">i64</a><a href="#impl-Serialize">usize</a><a href="#impl-Serialize">u8</a><a href="#impl-Serialize">u16</a><a href="#impl-Serialize">u32</a><a href="#impl-Serialize">u64</a><a href="#impl-Serialize">f32</a><a href="#impl-Serialize">f64</a><a href="#impl-Serialize">char</a><a href="#impl-Serialize">i128</a><a href="#impl-Serialize">u128</a><a href="#impl-Serialize">str</a><a href="#impl-Serialize">String</a><a href="#impl-Serialize">CStr</a><a href="#impl-Serialize">CString</a><a href="#impl-Serialize">Option<T></a><a href="#impl-Serialize">PhantomData<T></a><a href="#impl-Serialize">[T; 0]</a><a href="#impl-Serialize">[T; 1]</a><a href="#impl-Serialize">[T; 2]</a><a href="#impl-Serialize">[T; 3]</a><a href="#impl-Serialize">[T; 4]</a><a href="#impl-Serialize">[T; 5]</a><a href="#impl-Serialize">[T; 6]</a><a href="#impl-Serialize">[T; 7]</a><a href="#impl-Serialize">[T; 8]</a><a href="#impl-Serialize">[T; 9]</a><a href="#impl-Serialize">[T; 10]</a><a href="#impl-Serialize">[T; 11]</a><a href="#impl-Serialize">[T; 12]</a><a href="#impl-Serialize">[T; 13]</a><a href="#impl-Serialize">[T; 14]</a><a href="#impl-Serialize">[T; 15]</a><a href="#impl-Serialize">[T; 16]</a><a href="#impl-Serialize">[T; 17]</a><a href="#impl-Serialize">[T; 18]</a><a href="#impl-Serialize">[T; 19]</a><a href="#impl-Serialize">[T; 20]</a><a href="#impl-Serialize">[T; 21]</a><a href="#impl-Serialize">[T; 22]</a><a href="#impl-Serialize">[T; 23]</a><a href="#impl-Serialize">[T; 24]</a><a href="#impl-Serialize">[T; 25]</a><a href="#impl-Serialize">[T; 26]</a><a href="#impl-Serialize">[T; 27]</a><a href="#impl-Serialize">[T; 28]</a><a href="#impl-Serialize">[T; 29]</a><a href="#impl-Serialize">[T; 30]</a><a href="#impl-Serialize">[T; 31]</a><a href="#impl-Serialize">[T; 32]</a><a href="#impl-Serialize">[T]</a><a href="#impl-Serialize">BinaryHeap<T></a><a href="#impl-Serialize">BTreeSet<T></a><a href="#impl-Serialize">HashSet<T, H></a><a href="#impl-Serialize">LinkedList<T></a><a href="#impl-Serialize">Vec<T></a><a href="#impl-Serialize">VecDeque<T></a><a href="#impl-Serialize">Range<Idx></a><a href="#impl-Serialize">()</a><a href="#impl-Serialize">(T0,)</a><a href="#impl-Serialize">(T0, T1)</a><a href="#impl-Serialize">(T0, T1, T2)</a><a href="#impl-Serialize">(T0, T1, T2, T3)</a><a href="#impl-Serialize">(T0, T1, T2, T3, T4)</a><a href="#impl-Serialize">(T0, T1, T2, T3, T4, T5)</a><a href="#impl-Serialize">(T0, T1, T2, T3, T4, T5, T6)</a><a href="#impl-Serialize">(T0, T1, T2, T3, T4, T5, T6, T7)</a><a href="#impl-Serialize">(T0, T1, T2, T3, T4, T5, T6, T7, T8)</a><a href="#impl-Serialize">(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)</a><a href="#impl-Serialize">(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)</a><a href="#impl-Serialize">(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)</a><a href="#impl-Serialize">(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)</a><a href="#impl-Serialize">(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)</a><a href="#impl-Serialize">(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)</a><a href="#impl-Serialize">(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)</a><a href="#impl-Serialize">BTreeMap<K, V></a><a href="#impl-Serialize">HashMap<K, V, H></a><a href="#impl-Serialize">&'a T</a><a href="#impl-Serialize">&'a mut T</a><a href="#impl-Serialize">Box<T></a><a href="#impl-Serialize">Rc<T></a><a href="#impl-Serialize">Arc<T></a><a
|
|||
|
</nav>
|
|||
|
|
|||
|
<div class="theme-picker">
|
|||
|
<button id="theme-picker" aria-label="Pick another theme!">
|
|||
|
<img src="../brush.svg" width="18" alt="Pick another theme!">
|
|||
|
</button>
|
|||
|
<div id="theme-choices"></div>
|
|||
|
</div>
|
|||
|
<script src="../theme.js"></script>
|
|||
|
<nav class="sub">
|
|||
|
<form class="search-form js-only">
|
|||
|
<div class="search-container">
|
|||
|
<input class="search-input" name="search"
|
|||
|
autocomplete="off"
|
|||
|
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
|
|||
|
type="search">
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
</nav>
|
|||
|
|
|||
|
<section id='main' class="content"><h1 class='fqn'><span class='in-band'>Trait <a href='index.html'>serde</a>::<wbr><a class="trait" href=''>Serialize</a></span><span class='out-of-band'><span id='render-detail'>
|
|||
|
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
|
|||
|
[<span class='inner'>−</span>]
|
|||
|
</a>
|
|||
|
</span><a class='srclink' href='../src/serde/ser/mod.rs.html#215-249' title='goto source code'>[src]</a></span></h1><div class="docblock type-decl"><pre class='rust trait'>pub trait Serialize {
|
|||
|
fn <a href='#tymethod.serialize' class='fnname'>serialize</a><S>(&self, serializer: S) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Ok" title="type serde::Serializer::Ok">Ok</a>, S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Error" title="type serde::Serializer::Error">Error</a>><br> <span class="where">where<br> S: <a class="trait" href="../serde/trait.Serializer.html" title="trait serde::Serializer">Serializer</a></span>;
|
|||
|
}</pre></div><div class='docblock'><p>A <strong>data structure</strong> that can be serialized into any data format supported
|
|||
|
by Serde.</p>
|
|||
|
<p>Serde provides <code>Serialize</code> implementations for many Rust primitive and
|
|||
|
standard library types. The complete list is <a href="https://docs.serde.rs/serde/ser/index.html">here</a>. 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 <code>Serialize</code> implementations for structs and enums in
|
|||
|
your program. See the <a href="https://serde.rs/codegen.html">codegen section of the manual</a> for how to use this.</p>
|
|||
|
<p>In rare cases it may be necessary to implement <code>Serialize</code> 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 <code>Serialize</code> 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 <code>Serialize</code> for it.</p>
|
|||
|
</div>
|
|||
|
<h2 id='required-methods' class='small-section-header'>
|
|||
|
Required Methods<a href='#required-methods' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<div class='methods'>
|
|||
|
<h3 id='tymethod.serialize' class='method'><span id='serialize.v' class='invisible'><code>fn <a href='#tymethod.serialize' class='fnname'>serialize</a><S>(&self, serializer: S) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Ok" title="type serde::Serializer::Ok">Ok</a>, S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Error" title="type serde::Serializer::Error">Error</a>> <span class="where fmt-newline">where<br> S: <a class="trait" href="../serde/trait.Serializer.html" title="trait serde::Serializer">Serializer</a>, </span></code></span></h3><div class='docblock'><p>Serialize this value into the given Serde serializer.</p>
|
|||
|
<p>See the <a href="https://serde.rs/impl-serialize.html">Implementing <code>Serialize</code></a> section of the manual for more
|
|||
|
information about how to implement this method.</p>
|
|||
|
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">serde</span>::<span class="ident">ser</span>::{<span class="ident">Serialize</span>, <span class="ident">Serializer</span>, <span class="ident">SerializeStruct</span>};
|
|||
|
|
|||
|
<span class="kw">struct</span> <span class="ident">Person</span> {
|
|||
|
<span class="ident">name</span>: <span class="ident">String</span>,
|
|||
|
<span class="ident">age</span>: <span class="ident">u8</span>,
|
|||
|
<span class="ident">phones</span>: <span class="ident">Vec</span><span class="op"><</span><span class="ident">String</span><span class="op">></span>,
|
|||
|
}
|
|||
|
|
|||
|
<span class="comment">// This is what #[derive(Serialize)] would generate.</span>
|
|||
|
<span class="kw">impl</span> <span class="ident">Serialize</span> <span class="kw">for</span> <span class="ident">Person</span> {
|
|||
|
<span class="kw">fn</span> <span class="ident">serialize</span><span class="op"><</span><span class="ident">S</span><span class="op">></span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">serializer</span>: <span class="ident">S</span>) <span class="op">-></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">S</span>::<span class="prelude-val">Ok</span>, <span class="ident">S</span>::<span class="ident">Error</span><span class="op">></span>
|
|||
|
<span class="kw">where</span>
|
|||
|
<span class="ident">S</span>: <span class="ident">Serializer</span>,
|
|||
|
{
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">s</span> <span class="op">=</span> <span class="ident">serializer</span>.<span class="ident">serialize_struct</span>(<span class="string">"Person"</span>, <span class="number">3</span>)<span class="question-mark">?</span>;
|
|||
|
<span class="ident">s</span>.<span class="ident">serialize_field</span>(<span class="string">"name"</span>, <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">name</span>)<span class="question-mark">?</span>;
|
|||
|
<span class="ident">s</span>.<span class="ident">serialize_field</span>(<span class="string">"age"</span>, <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">age</span>)<span class="question-mark">?</span>;
|
|||
|
<span class="ident">s</span>.<span class="ident">serialize_field</span>(<span class="string">"phones"</span>, <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">phones</span>)<span class="question-mark">?</span>;
|
|||
|
<span class="ident">s</span>.<span class="ident">end</span>()
|
|||
|
}
|
|||
|
}</pre>
|
|||
|
</div></div>
|
|||
|
<h2 id='foreign-impls' class='small-section-header'>
|
|||
|
Implementations on Foreign Types<a href='#foreign-impls' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<h3 id='impl-Serialize' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../serde/trait.Serialize.html" title="trait serde::Serialize">Serialize</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a href='#impl-Serialize' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/serde/ser/impls.rs.html#17-25' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><span class='docblock autohide'><div class='impl-items'><h4 id='method.serialize' class="method"><span id='serialize.v-1' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.serialize' class='fnname'>serialize</a><S>(&self, serializer: S) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Ok" title="type serde::Serializer::Ok">Ok</a>, S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Error" title="type serde::Serializer::Error">Error</a>> <span class="where fmt-newline">where<br> S: <a class="trait" href="../serde/trait.Serializer.html" title="trait serde::Serializer">Serializer</a>, </span></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/serde/ser/impls.rs.html#19-24' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-Serialize-1' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../serde/trait.Serialize.html" title="trait serde::Serialize">Serialize</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a></code><a href='#impl-Serialize-1' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/serde/ser/impls.rs.html#17-25' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><span class='docblock autohide'><div class='impl-items'><h4 id='method.serialize-1' class="method"><span id='serialize.v-2' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.serialize' class='fnname'>serialize</a><S>(&self, serializer: S) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Ok" title="type serde::Serializer::Ok">Ok</a>, S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Error" title="type serde::Serializer::Error">Error</a>> <span class="where fmt-newline">where<br> S: <a class="trait" href="../serde/trait.Serializer.html" title="trait serde::Serializer">Serializer</a>, </span></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/serde/ser/impls.rs.html#19-24' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-Serialize-2' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../serde/trait.Serialize.html" title="trait serde::Serialize">Serialize</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a></code><a href='#impl-Serialize-2' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/serde/ser/impls.rs.html#17-25' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><span class='docblock autohide'><div class='impl-items'><h4 id='method.serialize-2' class="method"><span id='serialize.v-3' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.serialize' c
|
|||
|
<p>Serializing a data structure containing <code>Rc</code> will serialize a copy of
|
|||
|
the contents of the <code>Rc</code> each time the <code>Rc</code> is referenced within the
|
|||
|
data structure. Serialization will not attempt to deduplicate these
|
|||
|
repeated data.</p>
|
|||
|
</div><span class='docblock autohide'><div class='impl-items'><h4 id='method.serialize-85' class="method"><span id='serialize.v-86' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.serialize' class='fnname'>serialize</a><S>(&self, serializer: S) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Ok" title="type serde::Serializer::Ok">Ok</a>, S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Error" title="type serde::Serializer::Error">Error</a>> <span class="where fmt-newline">where<br> S: <a class="trait" href="../serde/trait.Serializer.html" title="trait serde::Serializer">Serializer</a>, </span></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/serde/ser/impls.rs.html#342-347' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-Serialize-86' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>> <a class="trait" href="../serde/trait.Serialize.html" title="trait serde::Serialize">Serialize</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/arc/struct.Arc.html" title="struct alloc::arc::Arc">Arc</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../serde/trait.Serialize.html" title="trait serde::Serialize">Serialize</a>, </span></code><a href='#impl-Serialize-86' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/serde/ser/impls.rs.html#340-348' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='docblock'><p>This impl requires the <a href="https://serde.rs/feature-flags.html#-features-rc"><code>"rc"</code></a> Cargo feature of Serde.</p>
|
|||
|
<p>Serializing a data structure containing <code>Arc</code> will serialize a copy of
|
|||
|
the contents of the <code>Arc</code> each time the <code>Arc</code> is referenced within the
|
|||
|
data structure. Serialization will not attempt to deduplicate these
|
|||
|
repeated data.</p>
|
|||
|
</div><span class='docblock autohide'><div class='impl-items'><h4 id='method.serialize-86' class="method"><span id='serialize.v-87' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.serialize' class='fnname'>serialize</a><S>(&self, serializer: S) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Ok" title="type serde::Serializer::Ok">Ok</a>, S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Error" title="type serde::Serializer::Error">Error</a>> <span class="where fmt-newline">where<br> S: <a class="trait" href="../serde/trait.Serializer.html" title="trait serde::Serializer">Serializer</a>, </span></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/serde/ser/impls.rs.html#342-347' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-Serialize-87' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<'a, T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>> <a class="trait" href="../serde/trait.Serialize.html" title="trait serde::Serialize">Serialize</a> for <a class="enum" href="https://doc.rust-lang.org/nightly/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a><'a, T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../serde/trait.Serialize.html" title="trait serde::Serialize">Serialize</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a>, </span></code><a href='#impl-Serialize-87' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/serde/ser/impls.rs.html#340-348' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><span class='docblock autohide'><div class='impl-items'><h4 id='method.serialize-87' class="method"><span id='serialize.v-88' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.serialize' class='fnname'>serialize</a><S>(&self, serializer: S) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Ok" title="type serde::Serializer::Ok">Ok</a>, S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Error" title="type serde::Serializer::Error">Error</a>> <span class="where fmt-newline">where<br> S: <a class="trait" href="../serde/trait.Serializer.html" title="trait serde::Serializer">Serializer</a>, </span></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/serde/ser/impls.rs.html#342-347' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-Serialize-88' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>> <a class="trait" href="../serde/trait.Serialize.html" title="trait serde::Serialize">Serialize</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/rc/struct.Weak.html" title="struct alloc::rc::Weak">RcWeak</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../serde/trait.Serialize.html" title="trait serde::Serialize">Serialize</a>, </span></code><a href='#impl-Serialize-88' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../
|
|||
|
</div><span class='docblock autohide'><div class='impl-items'><h4 id='method.serialize-88' class="method"><span id='serialize.v-89' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.serialize' class='fnname'>serialize</a><S>(&self, serializer: S) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Ok" title="type serde::Serializer::Ok">Ok</a>, S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Error" title="type serde::Serializer::Error">Error</a>> <span class="where fmt-newline">where<br> S: <a class="trait" href="../serde/trait.Serializer.html" title="trait serde::Serializer">Serializer</a>, </span></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/serde/ser/impls.rs.html#397-402' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-Serialize-89' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>> <a class="trait" href="../serde/trait.Serialize.html" title="trait serde::Serialize">Serialize</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/arc/struct.Weak.html" title="struct alloc::arc::Weak">ArcWeak</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../serde/trait.Serialize.html" title="trait serde::Serialize">Serialize</a>, </span></code><a href='#impl-Serialize-89' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/serde/ser/impls.rs.html#409-419' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='docblock'><p>This impl requires the <a href="https://serde.rs/feature-flags.html#-features-rc"><code>"rc"</code></a> Cargo feature of Serde.</p>
|
|||
|
</div><span class='docblock autohide'><div class='impl-items'><h4 id='method.serialize-89' class="method"><span id='serialize.v-90' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.serialize' class='fnname'>serialize</a><S>(&self, serializer: S) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Ok" title="type serde::Serializer::Ok">Ok</a>, S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Error" title="type serde::Serializer::Error">Error</a>> <span class="where fmt-newline">where<br> S: <a class="trait" href="../serde/trait.Serializer.html" title="trait serde::Serializer">Serializer</a>, </span></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/serde/ser/impls.rs.html#413-418' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-Serialize-90' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<T> <a class="trait" href="../serde/trait.Serialize.html" title="trait serde::Serialize">Serialize</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/cell/struct.Cell.html" title="struct core::cell::Cell">Cell</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../serde/trait.Serialize.html" title="trait serde::Serialize">Serialize</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a>, </span></code><a href='#impl-Serialize-90' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/serde/ser/impls.rs.html#449-459' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><span class='docblock autohide'><div class='impl-items'><h4 id='method.serialize-90' class="method"><span id='serialize.v-91' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.serialize' class='fnname'>serialize</a><S>(&self, serializer: S) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Ok" title="type serde::Serializer::Ok">Ok</a>, S::<a class="type" href="../serde/trait.Serializer.html#associatedtype.Error" title="type serde::Serializer::Error">Error</a>> <span class="where fmt-newline">where<br> S: <a class="trait" href="../serde/trait.Serializer.html" title="trait serde::Serializer">Serializer</a>, </span></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/serde/ser/impls.rs.html#453-458' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-Serialize-91' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<T> <a class="trait" href="../serde/trait.Serialize.html" title="trait serde::Serialize">Serialize</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/cell/struct.RefCell.html" title="struct core::cell::RefCell">RefCell</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../serde/trait.Serialize.html" title="trait serde::Serialize">Serialize</a>, </span></code><a href='#impl-Serialize-91' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/serde/ser/impls.rs.html#461-474' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><span class='docblock autohide'><div class='impl-items'><h4 id='method.serialize-91' class="method"><span id='serialize.v-92' class='invisible'><table class='table-display'><
|
|||
|
<h2 id='implementors' class='small-section-header'>
|
|||
|
Implementors<a href='#implementors' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<ul class='item-list' id='implementors-list'>
|
|||
|
</ul><script type="text/javascript">window.inlined_types=new Set([]);</script><script type="text/javascript" async
|
|||
|
src="../implementors/serde/trait.Serialize.js">
|
|||
|
</script></section>
|
|||
|
<section id='search' class="content hidden"></section>
|
|||
|
|
|||
|
<section class="footer"></section>
|
|||
|
|
|||
|
<aside id="help" class="hidden">
|
|||
|
<div>
|
|||
|
<h1 class="hidden">Help</h1>
|
|||
|
|
|||
|
<div class="shortcuts">
|
|||
|
<h2>Keyboard Shortcuts</h2>
|
|||
|
|
|||
|
<dl>
|
|||
|
<dt><kbd>?</kbd></dt>
|
|||
|
<dd>Show this help dialog</dd>
|
|||
|
<dt><kbd>S</kbd></dt>
|
|||
|
<dd>Focus the search field</dd>
|
|||
|
<dt><kbd>↑</kbd></dt>
|
|||
|
<dd>Move up in search results</dd>
|
|||
|
<dt><kbd>↓</kbd></dt>
|
|||
|
<dd>Move down in search results</dd>
|
|||
|
<dt><kbd>↹</kbd></dt>
|
|||
|
<dd>Switch tab</dd>
|
|||
|
<dt><kbd>⏎</kbd></dt>
|
|||
|
<dd>Go to active search result</dd>
|
|||
|
<dt><kbd>+</kbd></dt>
|
|||
|
<dd>Expand all sections</dd>
|
|||
|
<dt><kbd>-</kbd></dt>
|
|||
|
<dd>Collapse all sections</dd>
|
|||
|
</dl>
|
|||
|
</div>
|
|||
|
|
|||
|
<div class="infos">
|
|||
|
<h2>Search Tricks</h2>
|
|||
|
|
|||
|
<p>
|
|||
|
Prefix searches with a type followed by a colon (e.g.
|
|||
|
<code>fn:</code>) to restrict the search to a given type.
|
|||
|
</p>
|
|||
|
|
|||
|
<p>
|
|||
|
Accepted types are: <code>fn</code>, <code>mod</code>,
|
|||
|
<code>struct</code>, <code>enum</code>,
|
|||
|
<code>trait</code>, <code>type</code>, <code>macro</code>,
|
|||
|
and <code>const</code>.
|
|||
|
</p>
|
|||
|
|
|||
|
<p>
|
|||
|
Search functions by type signature (e.g.
|
|||
|
<code>vec -> usize</code> or <code>* -> vec</code>)
|
|||
|
</p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</aside>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<script>
|
|||
|
window.rootPath = "../";
|
|||
|
window.currentCrate = "serde";
|
|||
|
</script>
|
|||
|
<script src="../main.js"></script>
|
|||
|
<script defer src="../search-index.js"></script>
|
|||
|
</body>
|
|||
|
</html>
|