]> Untitled Git - bitcoindevkit.org/blob
42f03b01c90a4d54ee02369f19dd429b7b503d70
[bitcoindevkit.org] /
1 <!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 format that can serialize any data structure supported by Serde."><title>Serializer in bdk_chain::bitcoin::hashes::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-5d1d17d0.css"><meta name="rustdoc-vars" data-root-path="../../../../" data-static-root-path="../../../../static.files/" data-current-crate="bdk_chain" data-themes="" data-resource-suffix="" data-rustdoc-version="1.86.0-nightly (f3d1d47fd 2025-01-20)" data-channel="nightly" data-search-js="search-ccb196c1.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><a class="logo-container" href="../../../../bdk_chain/index.html"><img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../../../bdk_chain/index.html"><img src="https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png" alt="logo"></a><h2><a href="../../../../bdk_chain/index.html">bdk_<wbr>chain</a><span class="version">0.21.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Serializer</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-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><li><a href="#associatedtype.SerializeMap" title="SerializeMap">SerializeMap</a></li><li><a href="#associatedtype.SerializeSeq" title="SerializeSeq">SerializeSeq</a></li><li><a href="#associatedtype.SerializeStruct" title="SerializeStruct">SerializeStruct</a></li><li><a href="#associatedtype.SerializeStructVariant" title="SerializeStructVariant">SerializeStructVariant</a></li><li><a href="#associatedtype.SerializeTuple" title="SerializeTuple">SerializeTuple</a></li><li><a href="#associatedtype.SerializeTupleStruct" title="SerializeTupleStruct">SerializeTupleStruct</a></li><li><a href="#associatedtype.SerializeTupleVariant" title="SerializeTupleVariant">SerializeTupleVariant</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.serialize_bool" title="serialize_bool">serialize_bool</a></li><li><a href="#tymethod.serialize_bytes" title="serialize_bytes">serialize_bytes</a></li><li><a href="#tymethod.serialize_char" title="serialize_char">serialize_char</a></li><li><a href="#tymethod.serialize_f32" title="serialize_f32">serialize_f32</a></li><li><a href="#tymethod.serialize_f64" title="serialize_f64">serialize_f64</a></li><li><a href="#tymethod.serialize_i16" title="serialize_i16">serialize_i16</a></li><li><a href="#tymethod.serialize_i32" title="serialize_i32">serialize_i32</a></li><li><a href="#tymethod.serialize_i64" title="serialize_i64">serialize_i64</a></li><li><a href="#tymethod.serialize_i8" title="serialize_i8">serialize_i8</a></li><li><a href="#tymethod.serialize_map" title="serialize_map">serialize_map</a></li><li><a href="#tymethod.serialize_newtype_struct" title="serialize_newtype_struct">serialize_newtype_struct</a></li><li><a href="#tymethod.serialize_newtype_variant" title="serialize_newtype_variant">serialize_newtype_variant</a></li><li><a href="#tymethod.serialize_none" title="serialize_none">serialize_none</a></li><li><a href="#tymethod.serialize_seq" title="serialize_seq">serialize_seq</a></li><li><a href="#tymethod.serialize_some" title="serialize_some">serialize_some</a></li><li><a href="#tymethod.serialize_str" title="serialize_str">serialize_str</a></li><li><a href="#tymethod.serialize_struct" title="serialize_struct">serialize_struct</a></li><li><a href="#tymethod.serialize_struct_variant" title="serialize_struct_variant">serialize_struct_variant</a></li><li><a href="#tymethod.serialize_tuple" title="serialize_tuple">serialize_tuple</a></li><li><a href="#tymethod.serialize_tuple_struct" title="serialize_tuple_struct">serialize_tuple_struct</a></li><li><a href="#tymethod.serialize_tuple_variant" title="serialize_tuple_variant">serialize_tuple_variant</a></li><li><a href="#tymethod.serialize_u16" title="serialize_u16">serialize_u16</a></li><li><a href="#tymethod.serialize_u32" title="serialize_u32">serialize_u32</a></li><li><a href="#tymethod.serialize_u64" title="serialize_u64">serialize_u64</a></li><li><a href="#tymethod.serialize_u8" title="serialize_u8">serialize_u8</a></li><li><a href="#tymethod.serialize_unit" title="serialize_unit">serialize_unit</a></li><li><a href="#tymethod.serialize_unit_struct" title="serialize_unit_struct">serialize_unit_struct</a></li><li><a href="#tymethod.serialize_unit_variant" title="serialize_unit_variant">serialize_unit_variant</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.collect_map" title="collect_map">collect_map</a></li><li><a href="#method.collect_seq" title="collect_seq">collect_seq</a></li><li><a href="#method.collect_str" title="collect_str">collect_str</a></li><li><a href="#method.is_human_readable" title="is_human_readable">is_human_readable</a></li><li><a href="#method.serialize_i128" title="serialize_i128">serialize_i128</a></li><li><a href="#method.serialize_u128" title="serialize_u128">serialize_u128</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-Serializer-for-%26mut+Formatter%3C'a%3E" title="&#38;mut Formatter&#60;&#39;a&#62;">&#38;mut Formatter&#60;&#39;a&#62;</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In bdk_<wbr>chain::<wbr>bitcoin::<wbr>hashes::<wbr>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">bdk_chain</a>::<wbr><a href="../../index.html">bitcoin</a>::<wbr><a href="../index.html">hashes</a>::<wbr><a href="index.html">serde</a></span><h1>Trait <span class="trait">Serializer</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="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#340">Source</a> </span></div><pre class="rust item-decl"><code>pub trait Serializer: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
2 type <a href="#associatedtype.Ok" class="associatedtype">Ok</a>;
3 type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="ser/trait.Error.html" title="trait bdk_chain::bitcoin::hashes::serde::ser::Error">Error</a>;
4 type <a href="#associatedtype.SerializeSeq" class="associatedtype">SerializeSeq</a>: <a class="trait" href="ser/trait.SerializeSeq.html" title="trait bdk_chain::bitcoin::hashes::serde::ser::SerializeSeq">SerializeSeq</a>&lt;Ok = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Error = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
5 type <a href="#associatedtype.SerializeTuple" class="associatedtype">SerializeTuple</a>: <a class="trait" href="ser/trait.SerializeTuple.html" title="trait bdk_chain::bitcoin::hashes::serde::ser::SerializeTuple">SerializeTuple</a>&lt;Ok = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Error = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
6 type <a href="#associatedtype.SerializeTupleStruct" class="associatedtype">SerializeTupleStruct</a>: <a class="trait" href="ser/trait.SerializeTupleStruct.html" title="trait bdk_chain::bitcoin::hashes::serde::ser::SerializeTupleStruct">SerializeTupleStruct</a>&lt;Ok = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Error = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
7 type <a href="#associatedtype.SerializeTupleVariant" class="associatedtype">SerializeTupleVariant</a>: <a class="trait" href="ser/trait.SerializeTupleVariant.html" title="trait bdk_chain::bitcoin::hashes::serde::ser::SerializeTupleVariant">SerializeTupleVariant</a>&lt;Ok = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Error = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
8 type <a href="#associatedtype.SerializeMap" class="associatedtype">SerializeMap</a>: <a class="trait" href="ser/trait.SerializeMap.html" title="trait bdk_chain::bitcoin::hashes::serde::ser::SerializeMap">SerializeMap</a>&lt;Ok = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Error = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
9 type <a href="#associatedtype.SerializeStruct" class="associatedtype">SerializeStruct</a>: <a class="trait" href="ser/trait.SerializeStruct.html" title="trait bdk_chain::bitcoin::hashes::serde::ser::SerializeStruct">SerializeStruct</a>&lt;Ok = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Error = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
10 type <a href="#associatedtype.SerializeStructVariant" class="associatedtype">SerializeStructVariant</a>: <a class="trait" href="ser/trait.SerializeStructVariant.html" title="trait bdk_chain::bitcoin::hashes::serde::ser::SerializeStructVariant">SerializeStructVariant</a>&lt;Ok = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Error = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
11
12 <details class="toggle type-contents-toggle"><summary class="hideme"><span>Show 34 methods</span></summary> // Required methods
13 fn <a href="#tymethod.serialize_bool" class="fn">serialize_bool</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
14 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_i8" class="fn">serialize_i8</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
15 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_i16" class="fn">serialize_i16</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
16 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_i32" class="fn">serialize_i32</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
17 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_i64" class="fn">serialize_i64</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
18 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_u8" class="fn">serialize_u8</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
19 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_u16" class="fn">serialize_u16</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
20 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_u32" class="fn">serialize_u32</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
21 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_u64" class="fn">serialize_u64</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
22 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_f32" class="fn">serialize_f32</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
23 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_f64" class="fn">serialize_f64</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
24 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_char" class="fn">serialize_char</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.char.html">char</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
25 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_str" class="fn">serialize_str</a>(self, v: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
26 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_bytes" class="fn">serialize_bytes</a>(self, v: &amp;[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
27 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_none" class="fn">serialize_none</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
28 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_some" class="fn">serialize_some</a>&lt;T&gt;(self, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;
29 <span class="where">where T: <a class="trait" href="trait.Serialize.html" title="trait bdk_chain::bitcoin::hashes::serde::Serialize">Serialize</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>;
30 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_unit" class="fn">serialize_unit</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
31 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_unit_struct" class="fn">serialize_unit_struct</a>(
32 self,
33 name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
34 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
35 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_unit_variant" class="fn">serialize_unit_variant</a>(
36 self,
37 name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
38 variant_index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>,
39 variant: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
40 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
41 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_newtype_struct" class="fn">serialize_newtype_struct</a>&lt;T&gt;(
42 self,
43 name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
44 value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;T</a>,
45 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;
46 <span class="where">where T: <a class="trait" href="trait.Serialize.html" title="trait bdk_chain::bitcoin::hashes::serde::Serialize">Serialize</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>;
47 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_newtype_variant" class="fn">serialize_newtype_variant</a>&lt;T&gt;(
48 self,
49 name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
50 variant_index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>,
51 variant: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
52 value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;T</a>,
53 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;
54 <span class="where">where T: <a class="trait" href="trait.Serialize.html" title="trait bdk_chain::bitcoin::hashes::serde::Serialize">Serialize</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>;
55 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_seq" class="fn">serialize_seq</a>(
56 self,
57 len: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;,
58 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeSeq" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeSeq">SerializeSeq</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
59 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_tuple" class="fn">serialize_tuple</a>(
60 self,
61 len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
62 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeTuple" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeTuple">SerializeTuple</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
63 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_tuple_struct" class="fn">serialize_tuple_struct</a>(
64 self,
65 name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
66 len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
67 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeTupleStruct" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeTupleStruct">SerializeTupleStruct</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
68 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_tuple_variant" class="fn">serialize_tuple_variant</a>(
69 self,
70 name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
71 variant_index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>,
72 variant: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
73 len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
74 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeTupleVariant" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeTupleVariant">SerializeTupleVariant</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
75 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_map" class="fn">serialize_map</a>(
76 self,
77 len: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;,
78 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeMap" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeMap">SerializeMap</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
79 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_struct" class="fn">serialize_struct</a>(
80 self,
81 name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
82 len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
83 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeStruct" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeStruct">SerializeStruct</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
84 <span class="item-spacer"></span> fn <a href="#tymethod.serialize_struct_variant" class="fn">serialize_struct_variant</a>(
85 self,
86 name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
87 variant_index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>,
88 variant: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
89 len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
90 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeStructVariant" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeStructVariant">SerializeStructVariant</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;;
91
92 // Provided methods
93 fn <a href="#method.serialize_i128" class="fn">serialize_i128</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i128.html">i128</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt; { ... }
94 <span class="item-spacer"></span> fn <a href="#method.serialize_u128" class="fn">serialize_u128</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u128.html">u128</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt; { ... }
95 <span class="item-spacer"></span> fn <a href="#method.collect_seq" class="fn">collect_seq</a>&lt;I&gt;(self, iter: I) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;
96 <span class="where">where I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,
97 &lt;I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <a class="trait" href="trait.Serialize.html" title="trait bdk_chain::bitcoin::hashes::serde::Serialize">Serialize</a></span> { ... }
98 <span class="item-spacer"></span> fn <a href="#method.collect_map" class="fn">collect_map</a>&lt;K, V, I&gt;(self, iter: I) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;
99 <span class="where">where K: <a class="trait" href="trait.Serialize.html" title="trait bdk_chain::bitcoin::hashes::serde::Serialize">Serialize</a>,
100 V: <a class="trait" href="trait.Serialize.html" title="trait bdk_chain::bitcoin::hashes::serde::Serialize">Serialize</a>,
101 I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(K, V)</a>&gt;</span> { ... }
102 <span class="item-spacer"></span> fn <a href="#method.collect_str" class="fn">collect_str</a>&lt;T&gt;(self, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;
103 <span class="where">where T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
104 <span class="item-spacer"></span> fn <a href="#method.is_human_readable" class="fn">is_human_readable</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> { ... }
105 </details>}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A <strong>data format</strong> that can serialize any data structure supported by Serde.</p>
106 <p>The role of this trait is to define the serialization half of the <a href="https://serde.rs/data-model.html">Serde
107 data model</a>, which is a way to categorize every Rust data structure into one
108 of 29 possible types. Each method of the <code>Serializer</code> trait corresponds to
109 one of the types of the data model.</p>
110 <p>Implementations of <code>Serialize</code> map themselves into this data model by
111 invoking exactly one of the <code>Serializer</code> methods.</p>
112 <p>The types that make up the Serde data model are:</p>
113 <ul>
114 <li><strong>14 primitive types</strong>
115 <ul>
116 <li>bool</li>
117 <li>i8, i16, i32, i64, i128</li>
118 <li>u8, u16, u32, u64, u128</li>
119 <li>f32, f64</li>
120 <li>char</li>
121 </ul>
122 </li>
123 <li><strong>string</strong>
124 <ul>
125 <li>UTF-8 bytes with a length and no null terminator.</li>
126 <li>When serializing, all strings are handled equally. When deserializing,
127 there are three flavors of strings: transient, owned, and borrowed.</li>
128 </ul>
129 </li>
130 <li><strong>byte array</strong> - [u8]
131 <ul>
132 <li>Similar to strings, during deserialization byte arrays can be
133 transient, owned, or borrowed.</li>
134 </ul>
135 </li>
136 <li><strong>option</strong>
137 <ul>
138 <li>Either none or some value.</li>
139 </ul>
140 </li>
141 <li><strong>unit</strong>
142 <ul>
143 <li>The type of <code>()</code> in Rust. It represents an anonymous value containing
144 no data.</li>
145 </ul>
146 </li>
147 <li><strong>unit_struct</strong>
148 <ul>
149 <li>For example <code>struct Unit</code> or <code>PhantomData&lt;T&gt;</code>. It represents a named
150 value containing no data.</li>
151 </ul>
152 </li>
153 <li><strong>unit_variant</strong>
154 <ul>
155 <li>For example the <code>E::A</code> and <code>E::B</code> in <code>enum E { A, B }</code>.</li>
156 </ul>
157 </li>
158 <li><strong>newtype_struct</strong>
159 <ul>
160 <li>For example <code>struct Millimeters(u8)</code>.</li>
161 </ul>
162 </li>
163 <li><strong>newtype_variant</strong>
164 <ul>
165 <li>For example the <code>E::N</code> in <code>enum E { N(u8) }</code>.</li>
166 </ul>
167 </li>
168 <li><strong>seq</strong>
169 <ul>
170 <li>A variably sized heterogeneous sequence of values, for example
171 <code>Vec&lt;T&gt;</code> or <code>HashSet&lt;T&gt;</code>. When serializing, the length may or may not
172 be known before iterating through all the data. When deserializing,
173 the length is determined by looking at the serialized data.</li>
174 </ul>
175 </li>
176 <li><strong>tuple</strong>
177 <ul>
178 <li>A statically sized heterogeneous sequence of values for which the
179 length will be known at deserialization time without looking at the
180 serialized data, for example <code>(u8,)</code> or <code>(String, u64, Vec&lt;T&gt;)</code> or
181 <code>[u64; 10]</code>.</li>
182 </ul>
183 </li>
184 <li><strong>tuple_struct</strong>
185 <ul>
186 <li>A named tuple, for example <code>struct Rgb(u8, u8, u8)</code>.</li>
187 </ul>
188 </li>
189 <li><strong>tuple_variant</strong>
190 <ul>
191 <li>For example the <code>E::T</code> in <code>enum E { T(u8, u8) }</code>.</li>
192 </ul>
193 </li>
194 <li><strong>map</strong>
195 <ul>
196 <li>A heterogeneous key-value pairing, for example <code>BTreeMap&lt;K, V&gt;</code>.</li>
197 </ul>
198 </li>
199 <li><strong>struct</strong>
200 <ul>
201 <li>A heterogeneous key-value pairing in which the keys are strings and
202 will be known at deserialization time without looking at the
203 serialized data, for example <code>struct S { r: u8, g: u8, b: u8 }</code>.</li>
204 </ul>
205 </li>
206 <li><strong>struct_variant</strong>
207 <ul>
208 <li>For example the <code>E::S</code> in <code>enum E { S { r: u8, g: u8, b: u8 } }</code>.</li>
209 </ul>
210 </li>
211 </ul>
212 <p>Many Serde serializers produce text or binary data as output, for example
213 JSON or Postcard. This is not a requirement of the <code>Serializer</code> trait, and
214 there are serializers that do not produce text or binary output. One example
215 is the <code>serde_json::value::Serializer</code> (distinct from the main <code>serde_json</code>
216 serializer) that produces a <code>serde_json::Value</code> data structure in memory as
217 output.</p>
218 <h2 id="example-implementation"><a class="doc-anchor" href="#example-implementation">§</a>Example implementation</h2>
219 <p>The <a href="https://serde.rs/data-format.html">example data format</a> presented on the website contains example code for
220 a basic JSON <code>Serializer</code>.</p>
221 </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="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#349">Source</a><h4 class="code-header">type <a href="#associatedtype.Ok" class="associatedtype">Ok</a></h4></section></summary><div class="docblock"><p>The output type produced by this <code>Serializer</code> during successful
222 serialization. Most serializers that produce text or binary output
223 should set <code>Ok = ()</code> and serialize into an <a href="https://doc.rust-lang.org/std/io/trait.Write.html"><code>io::Write</code></a> or buffer
224 contained within the <code>Serializer</code> instance. Serializers that build
225 in-memory data structures may be simplified by using <code>Ok</code> to propagate
226 the data structure around.</p>
227 </div></details><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#352">Source</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="ser/trait.Error.html" title="trait bdk_chain::bitcoin::hashes::serde::ser::Error">Error</a></h4></section></summary><div class="docblock"><p>The error type when some error occurs during serialization.</p>
228 </div></details><details class="toggle" open><summary><section id="associatedtype.SerializeSeq" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#358">Source</a><h4 class="code-header">type <a href="#associatedtype.SerializeSeq" class="associatedtype">SerializeSeq</a>: <a class="trait" href="ser/trait.SerializeSeq.html" title="trait bdk_chain::bitcoin::hashes::serde::ser::SerializeSeq">SerializeSeq</a>&lt;Ok = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Error = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Type returned from <a href="#tymethod.serialize_seq"><code>serialize_seq</code></a> for serializing the content of the
229 sequence.</p>
230 </div></details><details class="toggle" open><summary><section id="associatedtype.SerializeTuple" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#364">Source</a><h4 class="code-header">type <a href="#associatedtype.SerializeTuple" class="associatedtype">SerializeTuple</a>: <a class="trait" href="ser/trait.SerializeTuple.html" title="trait bdk_chain::bitcoin::hashes::serde::ser::SerializeTuple">SerializeTuple</a>&lt;Ok = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Error = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Type returned from <a href="#tymethod.serialize_tuple"><code>serialize_tuple</code></a> for serializing the content of
231 the tuple.</p>
232 </div></details><details class="toggle" open><summary><section id="associatedtype.SerializeTupleStruct" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#370">Source</a><h4 class="code-header">type <a href="#associatedtype.SerializeTupleStruct" class="associatedtype">SerializeTupleStruct</a>: <a class="trait" href="ser/trait.SerializeTupleStruct.html" title="trait bdk_chain::bitcoin::hashes::serde::ser::SerializeTupleStruct">SerializeTupleStruct</a>&lt;Ok = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Error = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Type returned from <a href="#tymethod.serialize_tuple_struct"><code>serialize_tuple_struct</code></a> for serializing the
233 content of the tuple struct.</p>
234 </div></details><details class="toggle" open><summary><section id="associatedtype.SerializeTupleVariant" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#376">Source</a><h4 class="code-header">type <a href="#associatedtype.SerializeTupleVariant" class="associatedtype">SerializeTupleVariant</a>: <a class="trait" href="ser/trait.SerializeTupleVariant.html" title="trait bdk_chain::bitcoin::hashes::serde::ser::SerializeTupleVariant">SerializeTupleVariant</a>&lt;Ok = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Error = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Type returned from <a href="#tymethod.serialize_tuple_variant"><code>serialize_tuple_variant</code></a> for serializing the
235 content of the tuple variant.</p>
236 </div></details><details class="toggle" open><summary><section id="associatedtype.SerializeMap" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#382">Source</a><h4 class="code-header">type <a href="#associatedtype.SerializeMap" class="associatedtype">SerializeMap</a>: <a class="trait" href="ser/trait.SerializeMap.html" title="trait bdk_chain::bitcoin::hashes::serde::ser::SerializeMap">SerializeMap</a>&lt;Ok = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Error = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Type returned from <a href="#tymethod.serialize_map"><code>serialize_map</code></a> for serializing the content of the
237 map.</p>
238 </div></details><details class="toggle" open><summary><section id="associatedtype.SerializeStruct" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#388">Source</a><h4 class="code-header">type <a href="#associatedtype.SerializeStruct" class="associatedtype">SerializeStruct</a>: <a class="trait" href="ser/trait.SerializeStruct.html" title="trait bdk_chain::bitcoin::hashes::serde::ser::SerializeStruct">SerializeStruct</a>&lt;Ok = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Error = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Type returned from <a href="#tymethod.serialize_struct"><code>serialize_struct</code></a> for serializing the content of
239 the struct.</p>
240 </div></details><details class="toggle" open><summary><section id="associatedtype.SerializeStructVariant" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#394">Source</a><h4 class="code-header">type <a href="#associatedtype.SerializeStructVariant" class="associatedtype">SerializeStructVariant</a>: <a class="trait" href="ser/trait.SerializeStructVariant.html" title="trait bdk_chain::bitcoin::hashes::serde::ser::SerializeStructVariant">SerializeStructVariant</a>&lt;Ok = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Error = Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Type returned from <a href="#tymethod.serialize_struct_variant"><code>serialize_struct_variant</code></a> for serializing the
241 content of the struct variant.</p>
242 </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_bool" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#412">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_bool" class="fn">serialize_bool</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize a <code>bool</code> value.</p>
243
244 <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>Serialize <span class="kw">for </span>bool {
245 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
246 <span class="kw">where
247 </span>S: Serializer,
248 {
249 serializer.serialize_bool(<span class="kw-2">*</span><span class="self">self</span>)
250 }
251 }</code></pre></div>
252 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_i8" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#434">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_i8" class="fn">serialize_i8</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize an <code>i8</code> value.</p>
253 <p>If the format does not differentiate between <code>i8</code> and <code>i64</code>, a
254 reasonable implementation would be to cast the value to <code>i64</code> and
255 forward to <code>serialize_i64</code>.</p>
256
257 <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>Serialize <span class="kw">for </span>i8 {
258 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
259 <span class="kw">where
260 </span>S: Serializer,
261 {
262 serializer.serialize_i8(<span class="kw-2">*</span><span class="self">self</span>)
263 }
264 }</code></pre></div>
265 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_i16" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#456">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_i16" class="fn">serialize_i16</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize an <code>i16</code> value.</p>
266 <p>If the format does not differentiate between <code>i16</code> and <code>i64</code>, a
267 reasonable implementation would be to cast the value to <code>i64</code> and
268 forward to <code>serialize_i64</code>.</p>
269
270 <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>Serialize <span class="kw">for </span>i16 {
271 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
272 <span class="kw">where
273 </span>S: Serializer,
274 {
275 serializer.serialize_i16(<span class="kw-2">*</span><span class="self">self</span>)
276 }
277 }</code></pre></div>
278 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_i32" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#478">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_i32" class="fn">serialize_i32</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize an <code>i32</code> value.</p>
279 <p>If the format does not differentiate between <code>i32</code> and <code>i64</code>, a
280 reasonable implementation would be to cast the value to <code>i64</code> and
281 forward to <code>serialize_i64</code>.</p>
282
283 <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>Serialize <span class="kw">for </span>i32 {
284 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
285 <span class="kw">where
286 </span>S: Serializer,
287 {
288 serializer.serialize_i32(<span class="kw-2">*</span><span class="self">self</span>)
289 }
290 }</code></pre></div>
291 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_i64" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#496">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_i64" class="fn">serialize_i64</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize an <code>i64</code> value.</p>
292
293 <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>Serialize <span class="kw">for </span>i64 {
294 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
295 <span class="kw">where
296 </span>S: Serializer,
297 {
298 serializer.serialize_i64(<span class="kw-2">*</span><span class="self">self</span>)
299 }
300 }</code></pre></div>
301 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_u8" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#541">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_u8" class="fn">serialize_u8</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize a <code>u8</code> value.</p>
302 <p>If the format does not differentiate between <code>u8</code> and <code>u64</code>, a
303 reasonable implementation would be to cast the value to <code>u64</code> and
304 forward to <code>serialize_u64</code>.</p>
305
306 <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>Serialize <span class="kw">for </span>u8 {
307 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
308 <span class="kw">where
309 </span>S: Serializer,
310 {
311 serializer.serialize_u8(<span class="kw-2">*</span><span class="self">self</span>)
312 }
313 }</code></pre></div>
314 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_u16" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#563">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_u16" class="fn">serialize_u16</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize a <code>u16</code> value.</p>
315 <p>If the format does not differentiate between <code>u16</code> and <code>u64</code>, a
316 reasonable implementation would be to cast the value to <code>u64</code> and
317 forward to <code>serialize_u64</code>.</p>
318
319 <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>Serialize <span class="kw">for </span>u16 {
320 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
321 <span class="kw">where
322 </span>S: Serializer,
323 {
324 serializer.serialize_u16(<span class="kw-2">*</span><span class="self">self</span>)
325 }
326 }</code></pre></div>
327 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_u32" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#585">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_u32" class="fn">serialize_u32</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize a <code>u32</code> value.</p>
328 <p>If the format does not differentiate between <code>u32</code> and <code>u64</code>, a
329 reasonable implementation would be to cast the value to <code>u64</code> and
330 forward to <code>serialize_u64</code>.</p>
331
332 <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>Serialize <span class="kw">for </span>u32 {
333 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
334 <span class="kw">where
335 </span>S: Serializer,
336 {
337 serializer.serialize_u32(<span class="kw-2">*</span><span class="self">self</span>)
338 }
339 }</code></pre></div>
340 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_u64" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#603">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_u64" class="fn">serialize_u64</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize a <code>u64</code> value.</p>
341
342 <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>Serialize <span class="kw">for </span>u64 {
343 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
344 <span class="kw">where
345 </span>S: Serializer,
346 {
347 serializer.serialize_u64(<span class="kw-2">*</span><span class="self">self</span>)
348 }
349 }</code></pre></div>
350 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_f32" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#648">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_f32" class="fn">serialize_f32</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize an <code>f32</code> value.</p>
351 <p>If the format does not differentiate between <code>f32</code> and <code>f64</code>, a
352 reasonable implementation would be to cast the value to <code>f64</code> and
353 forward to <code>serialize_f64</code>.</p>
354
355 <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>Serialize <span class="kw">for </span>f32 {
356 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
357 <span class="kw">where
358 </span>S: Serializer,
359 {
360 serializer.serialize_f32(<span class="kw-2">*</span><span class="self">self</span>)
361 }
362 }</code></pre></div>
363 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_f64" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#666">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_f64" class="fn">serialize_f64</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize an <code>f64</code> value.</p>
364
365 <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>Serialize <span class="kw">for </span>f64 {
366 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
367 <span class="kw">where
368 </span>S: Serializer,
369 {
370 serializer.serialize_f64(<span class="kw-2">*</span><span class="self">self</span>)
371 }
372 }</code></pre></div>
373 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_char" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#687">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_char" class="fn">serialize_char</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.char.html">char</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize a character.</p>
374 <p>If the format does not support characters, it is reasonable to serialize
375 it as a single element <code>str</code> or a <code>u32</code>.</p>
376
377 <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>Serialize <span class="kw">for </span>char {
378 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
379 <span class="kw">where
380 </span>S: Serializer,
381 {
382 serializer.serialize_char(<span class="kw-2">*</span><span class="self">self</span>)
383 }
384 }</code></pre></div>
385 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_str" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#705">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_str" class="fn">serialize_str</a>(self, v: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize a <code>&amp;str</code>.</p>
386
387 <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>Serialize <span class="kw">for </span>str {
388 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
389 <span class="kw">where
390 </span>S: Serializer,
391 {
392 serializer.serialize_str(<span class="self">self</span>)
393 }
394 }</code></pre></div>
395 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_bytes" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#740">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_bytes" class="fn">serialize_bytes</a>(self, v: &amp;[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize a chunk of raw byte data.</p>
396 <p>Enables serializers to serialize byte slices more compactly or more
397 efficiently than other types of slices. If no efficient implementation
398 is available, a reasonable implementation would be to forward to
399 <code>serialize_seq</code>. If forwarded, the implementation looks usually just
400 like this:</p>
401
402 <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>serialize_bytes(<span class="self">self</span>, v: <span class="kw-2">&amp;</span>[u8]) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>::Ok, <span class="self">Self</span>::Error&gt; {
403 <span class="kw">let </span><span class="kw-2">mut </span>seq = <span class="self">self</span>.serialize_seq(<span class="prelude-val">Some</span>(v.len()))<span class="question-mark">?</span>;
404 <span class="kw">for </span>b <span class="kw">in </span>v {
405 seq.serialize_element(b)<span class="question-mark">?</span>;
406 }
407 seq.end()
408 }</code></pre></div>
409 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_none" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#773">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_none" class="fn">serialize_none</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize a <a href="https://doc.rust-lang.org/std/option/enum.Option.html#variant.None"><code>None</code></a> value.</p>
410
411 <div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">impl</span>&lt;T&gt; Serialize <span class="kw">for </span><span class="prelude-ty">Option</span>&lt;T&gt;
412 <span class="kw">where
413 </span>T: Serialize,
414 {
415 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
416 <span class="kw">where
417 </span>S: Serializer,
418 {
419 <span class="kw">match </span><span class="kw-2">*</span><span class="self">self </span>{
420 <span class="prelude-val">Some</span>(<span class="kw-2">ref </span>value) =&gt; serializer.serialize_some(value),
421 <span class="prelude-val">None </span>=&gt; serializer.serialize_none(),
422 }
423 }
424 }</code></pre></div>
425 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_some" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#806-808">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_some" class="fn">serialize_some</a>&lt;T&gt;(self, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;<div class="where">where
426 T: <a class="trait" href="trait.Serialize.html" title="trait bdk_chain::bitcoin::hashes::serde::Serialize">Serialize</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Serialize a <a href="https://doc.rust-lang.org/std/option/enum.Option.html#variant.Some"><code>Some(T)</code></a> value.</p>
427
428 <div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">impl</span>&lt;T&gt; Serialize <span class="kw">for </span><span class="prelude-ty">Option</span>&lt;T&gt;
429 <span class="kw">where
430 </span>T: Serialize,
431 {
432 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
433 <span class="kw">where
434 </span>S: Serializer,
435 {
436 <span class="kw">match </span><span class="kw-2">*</span><span class="self">self </span>{
437 <span class="prelude-val">Some</span>(<span class="kw-2">ref </span>value) =&gt; serializer.serialize_some(value),
438 <span class="prelude-val">None </span>=&gt; serializer.serialize_none(),
439 }
440 }
441 }</code></pre></div>
442 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_unit" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#826">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_unit" class="fn">serialize_unit</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize a <code>()</code> value.</p>
443
444 <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>Serialize <span class="kw">for </span>() {
445 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
446 <span class="kw">where
447 </span>S: Serializer,
448 {
449 serializer.serialize_unit()
450 }
451 }</code></pre></div>
452 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_unit_struct" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#846">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_unit_struct" class="fn">serialize_unit_struct</a>(
453 self,
454 name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
455 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize a unit struct like <code>struct Unit</code> or <code>PhantomData&lt;T&gt;</code>.</p>
456 <p>A reasonable implementation would be to forward to <code>serialize_unit</code>.</p>
457
458 <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::{Serialize, Serializer};
459
460 <span class="kw">struct </span>Nothing;
461
462 <span class="kw">impl </span>Serialize <span class="kw">for </span>Nothing {
463 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
464 <span class="kw">where
465 </span>S: Serializer,
466 {
467 serializer.serialize_unit_struct(<span class="string">"Nothing"</span>)
468 }
469 }</code></pre></div>
470 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_unit_variant" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#874-879">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_unit_variant" class="fn">serialize_unit_variant</a>(
471 self,
472 name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
473 variant_index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>,
474 variant: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
475 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize a unit variant like <code>E::A</code> in <code>enum E { A, B }</code>.</p>
476 <p>The <code>name</code> is the name of the enum, the <code>variant_index</code> is the index of
477 this variant within the enum, and the <code>variant</code> is the name of the
478 variant.</p>
479
480 <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::{Serialize, Serializer};
481
482 <span class="kw">enum </span>E {
483 A,
484 B,
485 }
486
487 <span class="kw">impl </span>Serialize <span class="kw">for </span>E {
488 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
489 <span class="kw">where
490 </span>S: Serializer,
491 {
492 <span class="kw">match </span><span class="kw-2">*</span><span class="self">self </span>{
493 E::A =&gt; serializer.serialize_unit_variant(<span class="string">"E"</span>, <span class="number">0</span>, <span class="string">"A"</span>),
494 E::B =&gt; serializer.serialize_unit_variant(<span class="string">"E"</span>, <span class="number">1</span>, <span class="string">"B"</span>),
495 }
496 }
497 }</code></pre></div>
498 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_newtype_struct" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#901-907">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_newtype_struct" class="fn">serialize_newtype_struct</a>&lt;T&gt;(
499 self,
500 name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
501 value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;T</a>,
502 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;<div class="where">where
503 T: <a class="trait" href="trait.Serialize.html" title="trait bdk_chain::bitcoin::hashes::serde::Serialize">Serialize</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Serialize a newtype struct like <code>struct Millimeters(u8)</code>.</p>
504 <p>Serializers are encouraged to treat newtype structs as insignificant
505 wrappers around the data they contain. A reasonable implementation would
506 be to forward to <code>value.serialize(self)</code>.</p>
507
508 <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::{Serialize, Serializer};
509
510 <span class="kw">struct </span>Millimeters(u8);
511
512 <span class="kw">impl </span>Serialize <span class="kw">for </span>Millimeters {
513 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
514 <span class="kw">where
515 </span>S: Serializer,
516 {
517 serializer.serialize_newtype_struct(<span class="string">"Millimeters"</span>, <span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">0</span>)
518 }
519 }</code></pre></div>
520 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_newtype_variant" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#935-943">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_newtype_variant" class="fn">serialize_newtype_variant</a>&lt;T&gt;(
521 self,
522 name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
523 variant_index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>,
524 variant: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
525 value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;T</a>,
526 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;<div class="where">where
527 T: <a class="trait" href="trait.Serialize.html" title="trait bdk_chain::bitcoin::hashes::serde::Serialize">Serialize</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Serialize a newtype variant like <code>E::N</code> in <code>enum E { N(u8) }</code>.</p>
528 <p>The <code>name</code> is the name of the enum, the <code>variant_index</code> is the index of
529 this variant within the enum, and the <code>variant</code> is the name of the
530 variant. The <code>value</code> is the data contained within this newtype variant.</p>
531
532 <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::{Serialize, Serializer};
533
534 <span class="kw">enum </span>E {
535 M(String),
536 N(u8),
537 }
538
539 <span class="kw">impl </span>Serialize <span class="kw">for </span>E {
540 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
541 <span class="kw">where
542 </span>S: Serializer,
543 {
544 <span class="kw">match </span><span class="kw-2">*</span><span class="self">self </span>{
545 E::M(<span class="kw-2">ref </span>s) =&gt; serializer.serialize_newtype_variant(<span class="string">"E"</span>, <span class="number">0</span>, <span class="string">"M"</span>, s),
546 E::N(n) =&gt; serializer.serialize_newtype_variant(<span class="string">"E"</span>, <span class="number">1</span>, <span class="string">"N"</span>, <span class="kw-2">&amp;</span>n),
547 }
548 }
549 }</code></pre></div>
550 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_seq" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#991">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_seq" class="fn">serialize_seq</a>(
551 self,
552 len: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;,
553 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeSeq" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeSeq">SerializeSeq</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Begin to serialize a variably sized sequence. This call must be
554 followed by zero or more calls to <code>serialize_element</code>, then a call to
555 <code>end</code>.</p>
556 <p>The argument is the number of elements in the sequence, which may or may
557 not be computable before the sequence is iterated. Some serializers only
558 support sequences whose length is known up front.</p>
559
560 <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};
561
562 <span class="kw">impl</span>&lt;T&gt; Serialize <span class="kw">for </span>Vec&lt;T&gt;
563 <span class="kw">where
564 </span>T: Serialize,
565 {
566 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
567 <span class="kw">where
568 </span>S: Serializer,
569 {
570 <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>;
571 <span class="kw">for </span>element <span class="kw">in </span><span class="self">self </span>{
572 seq.serialize_element(element)<span class="question-mark">?</span>;
573 }
574 seq.end()
575 }
576 }</code></pre></div>
577 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_tuple" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#1047">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_tuple" class="fn">serialize_tuple</a>(
578 self,
579 len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
580 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeTuple" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeTuple">SerializeTuple</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Begin to serialize a statically sized sequence whose length will be
581 known at deserialization time without looking at the serialized data.
582 This call must be followed by zero or more calls to <code>serialize_element</code>,
583 then a call to <code>end</code>.</p>
584
585 <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};
586
587 <span class="kw">impl</span>&lt;A, B, C&gt; Serialize <span class="kw">for </span>(A, B, C)
588 <span class="kw">where
589 </span>A: Serialize,
590 B: Serialize,
591 C: Serialize,
592 {
593 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
594 <span class="kw">where
595 </span>S: Serializer,
596 {
597 <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>;
598 tup.serialize_element(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">0</span>)<span class="question-mark">?</span>;
599 tup.serialize_element(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">1</span>)<span class="question-mark">?</span>;
600 tup.serialize_element(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">2</span>)<span class="question-mark">?</span>;
601 tup.end()
602 }
603 }</code></pre></div>
604
605 <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};
606
607 <span class="kw">const </span>VRAM_SIZE: usize = <span class="number">386</span>;
608 <span class="kw">struct </span>Vram([u16; VRAM_SIZE]);
609
610 <span class="kw">impl </span>Serialize <span class="kw">for </span>Vram {
611 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
612 <span class="kw">where
613 </span>S: Serializer,
614 {
615 <span class="kw">let </span><span class="kw-2">mut </span>seq = serializer.serialize_tuple(VRAM_SIZE)<span class="question-mark">?</span>;
616 <span class="kw">for </span>element <span class="kw">in </span><span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">0</span>[..] {
617 seq.serialize_element(element)<span class="question-mark">?</span>;
618 }
619 seq.end()
620 }
621 }</code></pre></div>
622 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_tuple_struct" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#1074-1078">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_tuple_struct" class="fn">serialize_tuple_struct</a>(
623 self,
624 name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
625 len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
626 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeTupleStruct" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeTupleStruct">SerializeTupleStruct</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Begin to serialize a tuple struct like <code>struct Rgb(u8, u8, u8)</code>. This
627 call must be followed by zero or more calls to <code>serialize_field</code>, then a
628 call to <code>end</code>.</p>
629 <p>The <code>name</code> is the name of the tuple struct and the <code>len</code> is the number
630 of data fields that will be serialized.</p>
631
632 <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};
633
634 <span class="kw">struct </span>Rgb(u8, u8, u8);
635
636 <span class="kw">impl </span>Serialize <span class="kw">for </span>Rgb {
637 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
638 <span class="kw">where
639 </span>S: Serializer,
640 {
641 <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>;
642 ts.serialize_field(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">0</span>)<span class="question-mark">?</span>;
643 ts.serialize_field(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">1</span>)<span class="question-mark">?</span>;
644 ts.serialize_field(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">2</span>)<span class="question-mark">?</span>;
645 ts.end()
646 }
647 }</code></pre></div>
648 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_tuple_variant" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#1119-1125">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_tuple_variant" class="fn">serialize_tuple_variant</a>(
649 self,
650 name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
651 variant_index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>,
652 variant: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
653 len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
654 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeTupleVariant" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeTupleVariant">SerializeTupleVariant</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Begin to serialize a tuple variant like <code>E::T</code> in <code>enum E { T(u8, u8) }</code>. This call must be followed by zero or more calls to
655 <code>serialize_field</code>, then a call to <code>end</code>.</p>
656 <p>The <code>name</code> is the name of the enum, the <code>variant_index</code> is the index of
657 this variant within the enum, the <code>variant</code> is the name of the variant,
658 and the <code>len</code> is the number of data fields that will be serialized.</p>
659
660 <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};
661
662 <span class="kw">enum </span>E {
663 T(u8, u8),
664 U(String, u32, u32),
665 }
666
667 <span class="kw">impl </span>Serialize <span class="kw">for </span>E {
668 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
669 <span class="kw">where
670 </span>S: Serializer,
671 {
672 <span class="kw">match </span><span class="kw-2">*</span><span class="self">self </span>{
673 E::T(<span class="kw-2">ref </span>a, <span class="kw-2">ref </span>b) =&gt; {
674 <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>;
675 tv.serialize_field(a)<span class="question-mark">?</span>;
676 tv.serialize_field(b)<span class="question-mark">?</span>;
677 tv.end()
678 }
679 E::U(<span class="kw-2">ref </span>a, <span class="kw-2">ref </span>b, <span class="kw-2">ref </span>c) =&gt; {
680 <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>;
681 tv.serialize_field(a)<span class="question-mark">?</span>;
682 tv.serialize_field(b)<span class="question-mark">?</span>;
683 tv.serialize_field(c)<span class="question-mark">?</span>;
684 tv.end()
685 }
686 }
687 }
688 }</code></pre></div>
689 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_map" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#1173">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_map" class="fn">serialize_map</a>(
690 self,
691 len: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;,
692 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeMap" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeMap">SerializeMap</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Begin to serialize a map. This call must be followed by zero or more
693 calls to <code>serialize_key</code> and <code>serialize_value</code>, then a call to <code>end</code>.</p>
694 <p>The argument is the number of elements in the map, which may or may not
695 be computable before the map is iterated. Some serializers only support
696 maps whose length is known up front.</p>
697
698 <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};
699
700 <span class="kw">impl</span>&lt;K, V&gt; Serialize <span class="kw">for </span>HashMap&lt;K, V&gt;
701 <span class="kw">where
702 </span>K: Serialize,
703 V: Serialize,
704 {
705 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
706 <span class="kw">where
707 </span>S: Serializer,
708 {
709 <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>;
710 <span class="kw">for </span>(k, v) <span class="kw">in </span><span class="self">self </span>{
711 map.serialize_entry(k, v)<span class="question-mark">?</span>;
712 }
713 map.end()
714 }
715 }</code></pre></div>
716 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_struct" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#1205-1209">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_struct" class="fn">serialize_struct</a>(
717 self,
718 name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
719 len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
720 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeStruct" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeStruct">SerializeStruct</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Begin to serialize a struct like <code>struct Rgb { r: u8, g: u8, b: u8 }</code>.
721 This call must be followed by zero or more calls to <code>serialize_field</code>,
722 then a call to <code>end</code>.</p>
723 <p>The <code>name</code> is the name of the struct and the <code>len</code> is the number of
724 data fields that will be serialized. <code>len</code> does not include fields
725 which are skipped with <a href="ser/trait.SerializeStruct.html#method.skip_field" title="method bdk_chain::bitcoin::hashes::serde::ser::SerializeStruct::skip_field"><code>SerializeStruct::skip_field</code></a>.</p>
726
727 <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};
728
729 <span class="kw">struct </span>Rgb {
730 r: u8,
731 g: u8,
732 b: u8,
733 }
734
735 <span class="kw">impl </span>Serialize <span class="kw">for </span>Rgb {
736 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
737 <span class="kw">where
738 </span>S: Serializer,
739 {
740 <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>;
741 rgb.serialize_field(<span class="string">"r"</span>, <span class="kw-2">&amp;</span><span class="self">self</span>.r)<span class="question-mark">?</span>;
742 rgb.serialize_field(<span class="string">"g"</span>, <span class="kw-2">&amp;</span><span class="self">self</span>.g)<span class="question-mark">?</span>;
743 rgb.serialize_field(<span class="string">"b"</span>, <span class="kw-2">&amp;</span><span class="self">self</span>.b)<span class="question-mark">?</span>;
744 rgb.end()
745 }
746 }</code></pre></div>
747 </div></details><details class="toggle method-toggle" open><summary><section id="tymethod.serialize_struct_variant" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#1249-1255">Source</a><h4 class="code-header">fn <a href="#tymethod.serialize_struct_variant" class="fn">serialize_struct_variant</a>(
748 self,
749 name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
750 variant_index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>,
751 variant: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
752 len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
753 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeStructVariant" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeStructVariant">SerializeStructVariant</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Begin to serialize a struct variant like <code>E::S</code> in <code>enum E { S { r: u8, g: u8, b: u8 } }</code>. This call must be followed by zero or more calls to
754 <code>serialize_field</code>, then a call to <code>end</code>.</p>
755 <p>The <code>name</code> is the name of the enum, the <code>variant_index</code> is the index of
756 this variant within the enum, the <code>variant</code> is the name of the variant,
757 and the <code>len</code> is the number of data fields that will be serialized.
758 <code>len</code> does not include fields which are skipped with
759 <a href="ser/trait.SerializeStructVariant.html#method.skip_field" title="method bdk_chain::bitcoin::hashes::serde::ser::SerializeStructVariant::skip_field"><code>SerializeStructVariant::skip_field</code></a>.</p>
760
761 <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};
762
763 <span class="kw">enum </span>E {
764 S { r: u8, g: u8, b: u8 },
765 }
766
767 <span class="kw">impl </span>Serialize <span class="kw">for </span>E {
768 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
769 <span class="kw">where
770 </span>S: Serializer,
771 {
772 <span class="kw">match </span><span class="kw-2">*</span><span class="self">self </span>{
773 E::S {
774 <span class="kw-2">ref </span>r,
775 <span class="kw-2">ref </span>g,
776 <span class="kw-2">ref </span>b,
777 } =&gt; {
778 <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>;
779 sv.serialize_field(<span class="string">"r"</span>, r)<span class="question-mark">?</span>;
780 sv.serialize_field(<span class="string">"g"</span>, g)<span class="question-mark">?</span>;
781 sv.serialize_field(<span class="string">"b"</span>, b)<span class="question-mark">?</span>;
782 sv.end()
783 }
784 }
785 }
786 }</code></pre></div>
787 </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_i128" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#516">Source</a><h4 class="code-header">fn <a href="#method.serialize_i128" class="fn">serialize_i128</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i128.html">i128</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize an <code>i128</code> value.</p>
788
789 <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>Serialize <span class="kw">for </span>i128 {
790 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
791 <span class="kw">where
792 </span>S: Serializer,
793 {
794 serializer.serialize_i128(<span class="kw-2">*</span><span class="self">self</span>)
795 }
796 }</code></pre></div>
797 <p>The default behavior unconditionally returns an error.</p>
798 </div></details><details class="toggle method-toggle" open><summary><section id="method.serialize_u128" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#623">Source</a><h4 class="code-header">fn <a href="#method.serialize_u128" class="fn">serialize_u128</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u128.html">u128</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Serialize a <code>u128</code> value.</p>
799
800 <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>Serialize <span class="kw">for </span>u128 {
801 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
802 <span class="kw">where
803 </span>S: Serializer,
804 {
805 serializer.serialize_u128(<span class="kw-2">*</span><span class="self">self</span>)
806 }
807 }</code></pre></div>
808 <p>The default behavior unconditionally returns an error.</p>
809 </div></details><details class="toggle method-toggle" open><summary><section id="method.collect_seq" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#1281-1284">Source</a><h4 class="code-header">fn <a href="#method.collect_seq" class="fn">collect_seq</a>&lt;I&gt;(self, iter: I) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;<div class="where">where
810 I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,
811 &lt;I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <a class="trait" href="trait.Serialize.html" title="trait bdk_chain::bitcoin::hashes::serde::Serialize">Serialize</a>,</div></h4></section></summary><div class="docblock"><p>Collect an iterator as a sequence.</p>
812 <p>The default implementation serializes each item yielded by the iterator
813 using <a href="#tymethod.serialize_seq"><code>serialize_seq</code></a>. Implementors should not need to override this
814 method.</p>
815
816 <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::{Serialize, Serializer};
817
818 <span class="kw">struct </span>SecretlyOneHigher {
819 data: Vec&lt;i32&gt;,
820 }
821
822 <span class="kw">impl </span>Serialize <span class="kw">for </span>SecretlyOneHigher {
823 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
824 <span class="kw">where
825 </span>S: Serializer,
826 {
827 serializer.collect_seq(<span class="self">self</span>.data.iter().map(|x| x + <span class="number">1</span>))
828 }
829 }</code></pre></div>
830 </div></details><details class="toggle method-toggle" open><summary><section id="method.collect_map" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#1318-1322">Source</a><h4 class="code-header">fn <a href="#method.collect_map" class="fn">collect_map</a>&lt;K, V, I&gt;(self, iter: I) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;<div class="where">where
831 K: <a class="trait" href="trait.Serialize.html" title="trait bdk_chain::bitcoin::hashes::serde::Serialize">Serialize</a>,
832 V: <a class="trait" href="trait.Serialize.html" title="trait bdk_chain::bitcoin::hashes::serde::Serialize">Serialize</a>,
833 I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(K, V)</a>&gt;,</div></h4></section></summary><div class="docblock"><p>Collect an iterator as a map.</p>
834 <p>The default implementation serializes each pair yielded by the iterator
835 using <a href="#tymethod.serialize_map"><code>serialize_map</code></a>. Implementors should not need to override this
836 method.</p>
837
838 <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::{Serialize, Serializer};
839 <span class="kw">use </span>std::collections::BTreeSet;
840
841 <span class="kw">struct </span>MapToUnit {
842 keys: BTreeSet&lt;i32&gt;,
843 }
844
845 <span class="comment">// Serializes as a map in which the values are all unit.
846 </span><span class="kw">impl </span>Serialize <span class="kw">for </span>MapToUnit {
847 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
848 <span class="kw">where
849 </span>S: Serializer,
850 {
851 serializer.collect_map(<span class="self">self</span>.keys.iter().map(|k| (k, ())))
852 }
853 }</code></pre></div>
854 </div></details><details class="toggle method-toggle" open><summary><section id="method.collect_str" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#1359-1361">Source</a><h4 class="code-header">fn <a href="#method.collect_str" class="fn">collect_str</a>&lt;T&gt;(self, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Ok" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.Serializer.html#associatedtype.Error" title="type bdk_chain::bitcoin::hashes::serde::Serializer::Error">Error</a>&gt;<div class="where">where
855 T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Serialize a string produced by an implementation of <code>Display</code>.</p>
856 <p>The default implementation builds a heap-allocated <a href="https://doc.rust-lang.org/std/string/struct.String.html"><code>String</code></a> and
857 delegates to <a href="#tymethod.serialize_str"><code>serialize_str</code></a>. Serializers are encouraged to provide a
858 more efficient implementation if possible.</p>
859
860 <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::{Serialize, Serializer};
861
862 <span class="kw">impl </span>Serialize <span class="kw">for </span>DateTime {
863 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
864 <span class="kw">where
865 </span>S: Serializer,
866 {
867 serializer.collect_str(<span class="kw-2">&amp;</span><span class="macro">format_args!</span>(<span class="string">"{:?}{:?}"</span>, <span class="self">self</span>.naive_local(), <span class="self">self</span>.offset()))
868 }
869 }</code></pre></div>
870 </div></details><details class="toggle method-toggle" open><summary><section id="method.is_human_readable" class="method"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/mod.rs.html#1445">Source</a><h4 class="code-header">fn <a href="#method.is_human_readable" class="fn">is_human_readable</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Determine whether <code>Serialize</code> implementations should serialize in
871 human-readable form.</p>
872 <p>Some types have a human-readable form that may be somewhat expensive to
873 construct, as well as a binary form that is compact and efficient.
874 Generally text-based formats like JSON and YAML will prefer to use the
875 human-readable one and binary formats like Postcard will prefer the
876 compact one.</p>
877
878 <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::{Serialize, Serializer};
879
880 <span class="kw">impl </span>Serialize <span class="kw">for </span>Timestamp {
881 <span class="kw">fn </span>serialize&lt;S&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, serializer: S) -&gt; <span class="prelude-ty">Result</span>&lt;S::Ok, S::Error&gt;
882 <span class="kw">where
883 </span>S: Serializer,
884 {
885 <span class="kw">if </span>serializer.is_human_readable() {
886 <span class="comment">// Serialize to a human-readable string "2015-05-15T17:01:00Z".
887 </span><span class="self">self</span>.to_string().serialize(serializer)
888 } <span class="kw">else </span>{
889 <span class="comment">// Serialize to a compact binary representation.
890 </span><span class="self">self</span>.seconds_since_epoch().serialize(serializer)
891 }
892 }
893 }</code></pre></div>
894 <p>The default implementation of this method returns <code>true</code>. Data formats
895 may override this to <code>false</code> to request a compact form for types that
896 support one. Note that modifying this method to change a format from
897 human-readable to compact or vice versa should be regarded as a breaking
898 change, as a value serialized in human-readable mode is not required to
899 deserialize from the same data in compact mode.</p>
900 </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/nightly/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-Serializer-for-%26mut+Formatter%3C'a%3E" class="impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#38">Source</a><a href="#impl-Serializer-for-%26mut+Formatter%3C'a%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'a&gt; <a class="trait" href="trait.Serializer.html" title="trait bdk_chain::bitcoin::hashes::serde::Serializer">Serializer</a> for &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'a&gt;</h3><div class="docblock">
901 <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;
902 <span class="kw">use </span>serde_derive::Serialize;
903 <span class="kw">use </span>std::fmt::{<span class="self">self</span>, Display};
904
905 <span class="attr">#[derive(Serialize)]
906 #[serde(rename_all = <span class="string">"kebab-case"</span>)]
907 </span><span class="kw">pub enum </span>MessageType {
908 StartRequest,
909 EndRequest,
910 }
911
912 <span class="kw">impl </span>Display <span class="kw">for </span>MessageType {
913 <span class="kw">fn </span>fmt(<span class="kw-2">&amp;</span><span class="self">self</span>, f: <span class="kw-2">&amp;mut </span>fmt::Formatter) -&gt; fmt::Result {
914 <span class="self">self</span>.serialize(f)
915 }
916 }</code></pre></div>
917 </div></section></summary><div class="impl-items"><section id="associatedtype.Ok-1" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#39">Source</a><a href="#associatedtype.Ok-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Ok" class="associatedtype">Ok</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a></h4></section><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#40">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a></h4></section><section id="associatedtype.SerializeSeq-1" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#41">Source</a><a href="#associatedtype.SerializeSeq-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.SerializeSeq" class="associatedtype">SerializeSeq</a> = <a class="struct" href="ser/struct.Impossible.html" title="struct bdk_chain::bitcoin::hashes::serde::ser::Impossible">Impossible</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="associatedtype.SerializeTuple-1" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#42">Source</a><a href="#associatedtype.SerializeTuple-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.SerializeTuple" class="associatedtype">SerializeTuple</a> = <a class="struct" href="ser/struct.Impossible.html" title="struct bdk_chain::bitcoin::hashes::serde::ser::Impossible">Impossible</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="associatedtype.SerializeTupleStruct-1" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#43">Source</a><a href="#associatedtype.SerializeTupleStruct-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.SerializeTupleStruct" class="associatedtype">SerializeTupleStruct</a> = <a class="struct" href="ser/struct.Impossible.html" title="struct bdk_chain::bitcoin::hashes::serde::ser::Impossible">Impossible</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="associatedtype.SerializeTupleVariant-1" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#44">Source</a><a href="#associatedtype.SerializeTupleVariant-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.SerializeTupleVariant" class="associatedtype">SerializeTupleVariant</a> = <a class="struct" href="ser/struct.Impossible.html" title="struct bdk_chain::bitcoin::hashes::serde::ser::Impossible">Impossible</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="associatedtype.SerializeMap-1" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#45">Source</a><a href="#associatedtype.SerializeMap-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.SerializeMap" class="associatedtype">SerializeMap</a> = <a class="struct" href="ser/struct.Impossible.html" title="struct bdk_chain::bitcoin::hashes::serde::ser::Impossible">Impossible</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="associatedtype.SerializeStruct-1" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#46">Source</a><a href="#associatedtype.SerializeStruct-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.SerializeStruct" class="associatedtype">SerializeStruct</a> = <a class="struct" href="ser/struct.Impossible.html" title="struct bdk_chain::bitcoin::hashes::serde::ser::Impossible">Impossible</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="associatedtype.SerializeStructVariant-1" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#47">Source</a><a href="#associatedtype.SerializeStructVariant-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.SerializeStructVariant" class="associatedtype">SerializeStructVariant</a> = <a class="struct" href="ser/struct.Impossible.html" title="struct bdk_chain::bitcoin::hashes::serde::ser::Impossible">Impossible</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_bool" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#49-66">Source</a><a href="#method.serialize_bool" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_bool" class="fn">serialize_bool</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_i8" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#49-66">Source</a><a href="#method.serialize_i8" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_i8" class="fn">serialize_i8</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_i16" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#49-66">Source</a><a href="#method.serialize_i16" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_i16" class="fn">serialize_i16</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_i32" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#49-66">Source</a><a href="#method.serialize_i32" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_i32" class="fn">serialize_i32</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_i64" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#49-66">Source</a><a href="#method.serialize_i64" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_i64" class="fn">serialize_i64</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_i128-1" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#49-66">Source</a><a href="#method.serialize_i128-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.serialize_i128" class="fn">serialize_i128</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i128.html">i128</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_u8" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#49-66">Source</a><a href="#method.serialize_u8" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_u8" class="fn">serialize_u8</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_u16" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#49-66">Source</a><a href="#method.serialize_u16" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_u16" class="fn">serialize_u16</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_u32" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#49-66">Source</a><a href="#method.serialize_u32" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_u32" class="fn">serialize_u32</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_u64" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#49-66">Source</a><a href="#method.serialize_u64" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_u64" class="fn">serialize_u64</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_u128-1" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#49-66">Source</a><a href="#method.serialize_u128-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.serialize_u128" class="fn">serialize_u128</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u128.html">u128</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_f32" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#49-66">Source</a><a href="#method.serialize_f32" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_f32" class="fn">serialize_f32</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_f64" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#49-66">Source</a><a href="#method.serialize_f64" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_f64" class="fn">serialize_f64</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_char" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#49-66">Source</a><a href="#method.serialize_char" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_char" class="fn">serialize_char</a>(self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.char.html">char</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_str" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#49-66">Source</a><a href="#method.serialize_str" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_str" class="fn">serialize_str</a>(self, v: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_unit_struct" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#49-66">Source</a><a href="#method.serialize_unit_struct" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_unit_struct" class="fn">serialize_unit_struct</a>(self, v: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_unit_variant" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#68-73">Source</a><a href="#method.serialize_unit_variant" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_unit_variant" class="fn">serialize_unit_variant</a>(
918 self,
919 _name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
920 _variant_index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>,
921 variant: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
922 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_newtype_struct" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#77-79">Source</a><a href="#method.serialize_newtype_struct" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_newtype_struct" class="fn">serialize_newtype_struct</a>&lt;T&gt;(
923 self,
924 _name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
925 value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;T</a>,
926 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;<div class="where">where
927 T: <a class="trait" href="trait.Serialize.html" title="trait bdk_chain::bitcoin::hashes::serde::Serialize">Serialize</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section><section id="method.serialize_bytes" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#84">Source</a><a href="#method.serialize_bytes" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_bytes" class="fn">serialize_bytes</a>(self, _v: &amp;[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_none" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#88">Source</a><a href="#method.serialize_none" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_none" class="fn">serialize_none</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_some" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#92-94">Source</a><a href="#method.serialize_some" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_some" class="fn">serialize_some</a>&lt;T&gt;(self, _value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;<div class="where">where
928 T: <a class="trait" href="trait.Serialize.html" title="trait bdk_chain::bitcoin::hashes::serde::Serialize">Serialize</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section><section id="method.serialize_unit" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#99">Source</a><a href="#method.serialize_unit" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_unit" class="fn">serialize_unit</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_newtype_variant" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#103-111">Source</a><a href="#method.serialize_newtype_variant" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_newtype_variant" class="fn">serialize_newtype_variant</a>&lt;T&gt;(
929 self,
930 _name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
931 _variant_index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>,
932 _variant: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
933 _value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;T</a>,
934 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;<div class="where">where
935 T: <a class="trait" href="trait.Serialize.html" title="trait bdk_chain::bitcoin::hashes::serde::Serialize">Serialize</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section><section id="method.serialize_seq" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#116">Source</a><a href="#method.serialize_seq" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_seq" class="fn">serialize_seq</a>(
936 self,
937 _len: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;,
938 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;&amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'a&gt; as <a class="trait" href="trait.Serializer.html" title="trait bdk_chain::bitcoin::hashes::serde::Serializer">Serializer</a>&gt;::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeSeq" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeSeq">SerializeSeq</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_tuple" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#120">Source</a><a href="#method.serialize_tuple" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_tuple" class="fn">serialize_tuple</a>(
939 self,
940 _len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
941 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;&amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'a&gt; as <a class="trait" href="trait.Serializer.html" title="trait bdk_chain::bitcoin::hashes::serde::Serializer">Serializer</a>&gt;::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeTuple" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeTuple">SerializeTuple</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_tuple_struct" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#124-128">Source</a><a href="#method.serialize_tuple_struct" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_tuple_struct" class="fn">serialize_tuple_struct</a>(
942 self,
943 _name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
944 _len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
945 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;&amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'a&gt; as <a class="trait" href="trait.Serializer.html" title="trait bdk_chain::bitcoin::hashes::serde::Serializer">Serializer</a>&gt;::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeTupleStruct" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeTupleStruct">SerializeTupleStruct</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_tuple_variant" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#132-138">Source</a><a href="#method.serialize_tuple_variant" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_tuple_variant" class="fn">serialize_tuple_variant</a>(
946 self,
947 _name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
948 _variant_index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>,
949 _variant: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
950 _len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
951 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;&amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'a&gt; as <a class="trait" href="trait.Serializer.html" title="trait bdk_chain::bitcoin::hashes::serde::Serializer">Serializer</a>&gt;::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeTupleVariant" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeTupleVariant">SerializeTupleVariant</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_map" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#142">Source</a><a href="#method.serialize_map" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_map" class="fn">serialize_map</a>(
952 self,
953 _len: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;,
954 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;&amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'a&gt; as <a class="trait" href="trait.Serializer.html" title="trait bdk_chain::bitcoin::hashes::serde::Serializer">Serializer</a>&gt;::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeMap" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeMap">SerializeMap</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_struct" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#146-150">Source</a><a href="#method.serialize_struct" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_struct" class="fn">serialize_struct</a>(
955 self,
956 _name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
957 _len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
958 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;&amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'a&gt; as <a class="trait" href="trait.Serializer.html" title="trait bdk_chain::bitcoin::hashes::serde::Serializer">Serializer</a>&gt;::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeStruct" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeStruct">SerializeStruct</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.serialize_struct_variant" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#154-160">Source</a><a href="#method.serialize_struct_variant" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.serialize_struct_variant" class="fn">serialize_struct_variant</a>(
959 self,
960 _name: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
961 _variant_index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>,
962 _variant: &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
963 _len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
964 ) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;&amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'a&gt; as <a class="trait" href="trait.Serializer.html" title="trait bdk_chain::bitcoin::hashes::serde::Serializer">Serializer</a>&gt;::<a class="associatedtype" href="trait.Serializer.html#associatedtype.SerializeStructVariant" title="type bdk_chain::bitcoin::hashes::serde::Serializer::SerializeStructVariant">SerializeStructVariant</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section><section id="method.collect_str-1" class="method trait-impl"><a class="src rightside" href="https://docs.rs/serde/1.0.217/src/serde/ser/fmt.rs.html#164-166">Source</a><a href="#method.collect_str-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.collect_str" class="fn">collect_str</a>&lt;T&gt;(self, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;T</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;<div class="where">where
965 T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</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/ser/trait.Serializer.js" data-ignore-extern-crates="core" async></script></section></div></main></body></html>