Debian Codegraph @

src/value/ser.rs

raw symbols SCIP
1 // Copyright 2017 Serde Developers
2 //
3 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6 // option. This file may not be copied, modified, or distributed
7 // except according to those terms.
8
9 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#;
10
11 use craterust-analyzer cargo serde_cbor_2 0.13.0 crate/::errorrust-analyzer cargo serde_cbor_2 0.13.0 error/::Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#;
12 use serderust-analyzer cargo serde 1.0.144 crate/::{selfrust-analyzer cargo serde 1.0.144 crate/, Serializerust-analyzer cargo serde 1.0.144 ser/Serialize#};
13
14 use craterust-analyzer cargo serde_cbor_2 0.13.0 crate/::tagsrust-analyzer cargo serde_cbor_2 0.13.0 tags/::Taggedrust-analyzer cargo serde_cbor_2 0.13.0 tags/Tagged#;
15 use craterust-analyzer cargo serde_cbor_2 0.13.0 crate/::valuerust-analyzer cargo serde_cbor_2 0.13.0 value/::Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#;
16
17 impl serderust-analyzer cargo serde 1.0.144 crate/::Serializerust-analyzer cargo serde 1.0.144 ser/Serialize# for Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value# {
18 #[inline]
19 fn serializerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Value][Serialize]serialize().<S>(&self, serializer: S) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<S::Okrust-analyzer cargo serde 1.0.144 ser/Serializer#Ok#, S::Errorrust-analyzer cargo serde 1.0.144 ser/Serializer#Error#>
20 where
21 S: serderust-analyzer cargo serde 1.0.144 crate/::Serializerrust-analyzer cargo serde 1.0.144 ser/Serializer#,
22 {
23 match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self {
24 Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Integerrust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Integer#(v) => serializer.serialize_i128rust-analyzer cargo serde 1.0.144 ser/Serializer#serialize_i128().(v),
25 Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Bytesrust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Bytes#(ref v) => serializer.serialize_bytesrust-analyzer cargo serde 1.0.144 ser/Serializer#serialize_bytes().(v),
26 Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Textrust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Text#(ref v) => serializer.serialize_strrust-analyzer cargo serde 1.0.144 ser/Serializer#serialize_str().(v),
27 Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Arrayrust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Array#(ref v) => v.serializerust-analyzer cargo serde 1.0.144 ser/impls/impl#[`Vec<T>`][Serialize]serialize().(serializer),
28 Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Maprust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Map#(ref v) => v.serializerust-analyzer cargo serde 1.0.144 ser/impls/impl#[`BTreeMap<K, V>`][Serialize]serialize().(serializer),
29 Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Tagrust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Tag#(tag, ref v) => Taggedrust-analyzer cargo serde_cbor_2 0.13.0 tags/Tagged#::newrust-analyzer cargo serde_cbor_2 0.13.0 tags/impl#[`Tagged<T>`]new().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(tag), v).serializerust-analyzer cargo serde_cbor_2 0.13.0 tags/impl#[`Tagged<T>`][Serialize]serialize().(serializer),
30 Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Floatrust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Float#(v) => serializer.serialize_f64rust-analyzer cargo serde 1.0.144 ser/Serializer#serialize_f64().(v),
31 Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Boolrust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Bool#(v) => serializer.serialize_boolrust-analyzer cargo serde 1.0.144 ser/Serializer#serialize_bool().(v),
32 Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Nullrust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Null# => serializer.serialize_unitrust-analyzer cargo serde 1.0.144 ser/Serializer#serialize_unit().(),
33 Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::__Hiddenrust-analyzer cargo serde_cbor_2 0.13.0 value/Value#__Hidden# => unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!(),
34 }
35 }
36 }
37
38 struct Serializerrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/Serializer#;
39
40 impl serderust-analyzer cargo serde 1.0.144 crate/::Serializerrust-analyzer cargo serde 1.0.144 ser/Serializer# for Serializerrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/Serializer# {
41 type Okrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]Ok# = Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#;
42 type Errorrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]Error# = Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#;
43
44 type SerializeSeqrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]SerializeSeq# = SerializeVecrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeVec#;
45 type SerializeTuplerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]SerializeTuple# = SerializeVecrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeVec#;
46 type SerializeTupleStructrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]SerializeTupleStruct# = SerializeVecrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeVec#;
47 type SerializeTupleVariantrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]SerializeTupleVariant# = SerializeTupleVariantrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeTupleVariant#;
48 type SerializeMaprust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]SerializeMap# = SerializeMaprust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeMap#;
49 type SerializeStructrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]SerializeStruct# = SerializeMaprust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeMap#;
50 type SerializeStructVariantrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]SerializeStructVariant# = SerializeStructVariantrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeStructVariant#;
51
52 #[inline]
53 fn serialize_boolrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_bool().(self, value: bool) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
54 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Boolrust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Bool#(value))
55 }
56
57 #[inline]
58 fn serialize_i8rust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_i8().(self, value: i8) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
59 self.serialize_i64rust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_i64().(i64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i64][`From<i8>`]from().(value))
60 }
61
62 #[inline]
63 fn serialize_i16rust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_i16().(self, value: i16) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
64 self.serialize_i64rust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_i64().(i64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i64][`From<i16>`]from().(value))
65 }
66
67 #[inline]
68 fn serialize_i32rust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_i32().(self, value: i32) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
69 self.serialize_i64rust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_i64().(i64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i64][`From<i32>`]from().(value))
70 }
71
72 #[inline]
73 fn serialize_i64rust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_i64().(self, value: i64) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
74 self.serialize_i128rust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_i128().(i128::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i128][`From<i64>`]from().(value))
75 }
76
77 fn serialize_i128rust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_i128().(self, value: i128) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
78 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Integerrust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Integer#(value))
79 }
80
81 #[inline]
82 fn serialize_u8rust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_u8().(self, value: u8) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
83 self.serialize_u64rust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_u64().(u64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u64][`From<u8>`]from().(value))
84 }
85
86 #[inline]
87 fn serialize_u16rust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_u16().(self, value: u16) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
88 self.serialize_u64rust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_u64().(u64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u64][`From<u16>`]from().(value))
89 }
90
91 #[inline]
92 fn serialize_u32rust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_u32().(self, value: u32) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
93 self.serialize_u64rust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_u64().(u64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u64][`From<u32>`]from().(value))
94 }
95
96 #[inline]
97 fn serialize_u64rust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_u64().(self, value: u64) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
98 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Integerrust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Integer#(value.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))
99 }
100
101 #[inline]
102 fn serialize_f32rust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_f32().(self, value: f32) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
103 self.serialize_f64rust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_f64().(f64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[f64][`From<f32>`]from().(value))
104 }
105
106 #[inline]
107 fn serialize_f64rust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_f64().(self, value: f64) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
108 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Floatrust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Float#(value))
109 }
110
111 #[inline]
112 fn serialize_charrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_char().(self, value: char) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
113 let mut s = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().();
114 s.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(value);
115 self.serialize_strrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_str().(&s)
116 }
117
118 #[inline]
119 fn serialize_strrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_str().(self, value: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
120 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Textrust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Text#(value.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()))
121 }
122
123 fn serialize_bytesrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_bytes().(self, value: &[u8]) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
124 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Bytesrust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Bytes#(value.to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().()))
125 }
126
127 #[inline]
128 fn serialize_unitrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_unit().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
129 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Nullrust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Null#)
130 }
131
132 #[inline]
133 fn serialize_unit_structrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_unit_struct().(self, _name: &'static str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
134 self.serialize_unitrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_unit().()
135 }
136
137 #[inline]
138 fn serialize_unit_variantrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_unit_variant().(
139 self,
140 _name: &'static str,
141 _variant_index: u32,
142 variant: &'static str,
143 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
144 self.serialize_strrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_str().(variant)
145 }
146
147 #[inline]
148 fn serialize_newtype_structrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_newtype_struct().<T>(self, _name: &'static str, value: &T) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#>
149 where
150 T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde 1.0.144 ser/Serialize#,
151 {
152 value.serializerust-analyzer cargo serde 1.0.144 ser/Serialize#serialize().(self)
153 }
154
155 fn serialize_newtype_variantrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_newtype_variant().<T>(
156 self,
157 _name: &'static str,
158 _variant_index: u32,
159 variant: &'static str,
160 value: &T,
161 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#>
162 where
163 T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde 1.0.144 ser/Serialize#,
164 {
165 let mut values = BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`]new().();
166 values.insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().(Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::fromrust-analyzer cargo serde_cbor_2 0.13.0 value/impl#[Value][`From<String>`]from().(variant.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()), to_valuerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/to_value().(value)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().);
167 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Maprust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Map#(values))
168 }
169
170 #[inline]
171 fn serialize_nonerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_none().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
172 self.serialize_unitrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_unit().()
173 }
174
175 #[inline]
176 fn serialize_somerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_some().<T>(self, value: &T) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#>
177 where
178 T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde 1.0.144 ser/Serialize#,
179 {
180 value.serializerust-analyzer cargo serde 1.0.144 ser/Serialize#serialize().(self)
181 }
182
183 fn serialize_seqrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_seq().(self, len: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]::SerializeSeqrust-analyzer cargo serde 1.0.144 ser/Serializer#SerializeSeq#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
184 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(SerializeVecrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeVec# {
185 vecrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeVec#vec.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(len.unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(0)),
186 })
187 }
188
189 fn serialize_tuplerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_tuple().(self, len: usize) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]::SerializeTuplerust-analyzer cargo serde 1.0.144 ser/Serializer#SerializeTuple#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
190 self.serialize_seqrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_seq().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(len))
191 }
192
193 fn serialize_tuple_structrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_tuple_struct().(
194 self,
195 _name: &'static str,
196 len: usize,
197 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]::SerializeTupleStructrust-analyzer cargo serde 1.0.144 ser/Serializer#SerializeTupleStruct#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
198 self.serialize_tuplerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_tuple().(len)
199 }
200
201 fn serialize_tuple_variantrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_tuple_variant().(
202 self,
203 _name: &'static str,
204 _variant_index: u32,
205 variant: &'static str,
206 len: usize,
207 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]::SerializeTupleVariantrust-analyzer cargo serde 1.0.144 ser/Serializer#SerializeTupleVariant#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
208 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(SerializeTupleVariantrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeTupleVariant# {
209 namerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeTupleVariant#name.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().(variant),
210 vecrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeTupleVariant#vec.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(len),
211 })
212 }
213
214 fn serialize_maprust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_map().(self, _len: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]::SerializeMaprust-analyzer cargo serde 1.0.144 ser/Serializer#SerializeMap#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
215 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(SerializeMaprust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeMap# {
216 maprust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeMap#map.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`]new().(),
217 next_keyrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeMap#next_key.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
218 })
219 }
220
221 fn serialize_structrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_struct().(
222 self,
223 _name: &'static str,
224 len: usize,
225 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]::SerializeStructrust-analyzer cargo serde 1.0.144 ser/Serializer#SerializeStruct#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
226 self.serialize_maprust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_map().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(len))
227 }
228
229 fn serialize_struct_variantrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]serialize_struct_variant().(
230 self,
231 _name: &'static str,
232 _variant_index: u32,
233 variant: &'static str,
234 _len: usize,
235 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]::SerializeStructVariantrust-analyzer cargo serde 1.0.144 ser/Serializer#SerializeStructVariant#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
236 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(SerializeStructVariantrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeStructVariant# {
237 namerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeStructVariant#name.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().(variant),
238 maprust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeStructVariant#map.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`]new().(),
239 })
240 }
241
242 #[inline]
243 fn is_human_readablerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[Serializer][Serializer]is_human_readable().(&self) -> bool {
244 false
245 }
246 }
247
248 pub struct SerializeVecrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeVec# {
249 vecrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeVec#vec.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#>,
250 }
251
252 pub struct SerializeTupleVariantrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeTupleVariant# {
253 namerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeTupleVariant#name.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
254 vecrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeTupleVariant#vec.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#>,
255 }
256
257 pub struct SerializeMaprust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeMap# {
258 maprust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeMap#map.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#>,
259 next_keyrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeMap#next_key.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#>,
260 }
261
262 pub struct SerializeStructVariantrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeStructVariant# {
263 namerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeStructVariant#name.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
264 maprust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeStructVariant#map.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#>,
265 }
266
267 impl serderust-analyzer cargo serde 1.0.144 crate/::serrust-analyzer cargo serde 1.0.144 ser/::SerializeSeqrust-analyzer cargo serde 1.0.144 ser/SerializeSeq# for SerializeVecrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeVec# {
268 type Okrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeVec][SerializeSeq]Ok# = Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#;
269 type Errorrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeVec][SerializeSeq]Error# = Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#;
270
271 fn serialize_elementrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeVec][SerializeSeq]serialize_element().<T>(&mut self, value: &T) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#>
272 where
273 T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde 1.0.144 ser/Serialize#,
274 {
275 self.vecrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeVec#vec..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(to_valuerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/to_value().(value)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().);
276 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
277 }
278
279 fn endrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeVec][SerializeSeq]end().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
280 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Arrayrust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Array#(self.vecrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeVec#vec.))
281 }
282 }
283
284 impl serderust-analyzer cargo serde 1.0.144 crate/::serrust-analyzer cargo serde 1.0.144 ser/::SerializeTuplerust-analyzer cargo serde 1.0.144 ser/SerializeTuple# for SerializeVecrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeVec# {
285 type Okrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeVec][SerializeTuple]Ok# = Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#;
286 type Errorrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeVec][SerializeTuple]Error# = Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#;
287
288 fn serialize_elementrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeVec][SerializeTuple]serialize_element().<T>(&mut self, value: &T) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#>
289 where
290 T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde 1.0.144 ser/Serialize#,
291 {
292 serderust-analyzer cargo serde 1.0.144 crate/::serrust-analyzer cargo serde 1.0.144 ser/::SerializeSeqrust-analyzer cargo serde 1.0.144 ser/SerializeSeq#::serialize_elementrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeVec][SerializeSeq]serialize_element().(self, value)
293 }
294
295 fn endrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeVec][SerializeTuple]end().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
296 serderust-analyzer cargo serde 1.0.144 crate/::serrust-analyzer cargo serde 1.0.144 ser/::SerializeSeqrust-analyzer cargo serde 1.0.144 ser/SerializeSeq#::endrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeVec][SerializeSeq]end().(self)
297 }
298 }
299
300 impl serderust-analyzer cargo serde 1.0.144 crate/::serrust-analyzer cargo serde 1.0.144 ser/::SerializeTupleStructrust-analyzer cargo serde 1.0.144 ser/SerializeTupleStruct# for SerializeVecrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeVec# {
301 type Okrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeVec][SerializeTupleStruct]Ok# = Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#;
302 type Errorrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeVec][SerializeTupleStruct]Error# = Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#;
303
304 fn serialize_fieldrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeVec][SerializeTupleStruct]serialize_field().<T>(&mut self, value: &T) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#>
305 where
306 T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde 1.0.144 ser/Serialize#,
307 {
308 serderust-analyzer cargo serde 1.0.144 crate/::serrust-analyzer cargo serde 1.0.144 ser/::SerializeSeqrust-analyzer cargo serde 1.0.144 ser/SerializeSeq#::serialize_elementrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeVec][SerializeSeq]serialize_element().(self, value)
309 }
310
311 fn endrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeVec][SerializeTupleStruct]end().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
312 serderust-analyzer cargo serde 1.0.144 crate/::serrust-analyzer cargo serde 1.0.144 ser/::SerializeSeqrust-analyzer cargo serde 1.0.144 ser/SerializeSeq#::endrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeVec][SerializeSeq]end().(self)
313 }
314 }
315
316 impl serderust-analyzer cargo serde 1.0.144 crate/::serrust-analyzer cargo serde 1.0.144 ser/::SerializeTupleVariantrust-analyzer cargo serde 1.0.144 ser/SerializeTupleVariant# for SerializeTupleVariantrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeTupleVariant# {
317 type Okrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeTupleVariant][SerializeTupleVariant]Ok# = Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#;
318 type Errorrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeTupleVariant][SerializeTupleVariant]Error# = Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#;
319
320 fn serialize_fieldrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeTupleVariant][SerializeTupleVariant]serialize_field().<T>(&mut self, value: &T) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#>
321 where
322 T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde 1.0.144 ser/Serialize#,
323 {
324 self.vecrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeTupleVariant#vec..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(to_valuerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/to_value().(value)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().);
325 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
326 }
327
328 fn endrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeTupleVariant][SerializeTupleVariant]end().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
329 let mut object = BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`]new().();
330
331 object.insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().(Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::fromrust-analyzer cargo serde_cbor_2 0.13.0 value/impl#[Value][`From<String>`]from().(self.namerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeTupleVariant#name.), Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Arrayrust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Array#(self.vecrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeTupleVariant#vec.));
332
333 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Maprust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Map#(object))
334 }
335 }
336
337 impl serderust-analyzer cargo serde 1.0.144 crate/::serrust-analyzer cargo serde 1.0.144 ser/::SerializeMaprust-analyzer cargo serde 1.0.144 ser/SerializeMap# for SerializeMaprust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeMap# {
338 type Okrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeMap][SerializeMap]Ok# = Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#;
339 type Errorrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeMap][SerializeMap]Error# = Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#;
340
341 fn serialize_keyrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeMap][SerializeMap]serialize_key().<T>(&mut self, key: &T) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#>
342 where
343 T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde 1.0.144 ser/Serialize#,
344 {
345 self.next_keyrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeMap#next_key. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(to_valuerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/to_value().(key)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().);
346 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
347 }
348
349 fn serialize_valuerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeMap][SerializeMap]serialize_value().<T>(&mut self, value: &T) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#>
350 where
351 T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde 1.0.144 ser/Serialize#,
352 {
353 let key = self.next_keyrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeMap#next_key..takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]take().();
354 // Panic because this indicates a bug in the program rather than an
355 // expected failure.
356 let key = key.expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("serialize_value called before serialize_key");
357 self.maprust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeMap#map..insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().(key, to_valuerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/to_value().(value)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().);
358 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
359 }
360
361 fn endrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeMap][SerializeMap]end().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
362 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Maprust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Map#(self.maprust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeMap#map.))
363 }
364 }
365
366 impl serderust-analyzer cargo serde 1.0.144 crate/::serrust-analyzer cargo serde 1.0.144 ser/::SerializeStructrust-analyzer cargo serde 1.0.144 ser/SerializeStruct# for SerializeMaprust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeMap# {
367 type Okrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeMap][SerializeStruct]Ok# = Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#;
368 type Errorrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeMap][SerializeStruct]Error# = Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#;
369
370 fn serialize_fieldrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeMap][SerializeStruct]serialize_field().<T>(&mut self, key: &'static str, value: &T) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#>
371 where
372 T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde 1.0.144 ser/Serialize#,
373 {
374 serderust-analyzer cargo serde 1.0.144 crate/::serrust-analyzer cargo serde 1.0.144 ser/::SerializeMaprust-analyzer cargo serde 1.0.144 ser/SerializeMap#::serialize_keyrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeMap][SerializeMap]serialize_key().(self, key)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
375 serderust-analyzer cargo serde 1.0.144 crate/::serrust-analyzer cargo serde 1.0.144 ser/::SerializeMaprust-analyzer cargo serde 1.0.144 ser/SerializeMap#::serialize_valuerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeMap][SerializeMap]serialize_value().(self, value)
376 }
377
378 fn endrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeMap][SerializeStruct]end().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
379 serderust-analyzer cargo serde 1.0.144 crate/::serrust-analyzer cargo serde 1.0.144 ser/::SerializeMaprust-analyzer cargo serde 1.0.144 ser/SerializeMap#::endrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeMap][SerializeMap]end().(self)
380 }
381 }
382
383 impl serderust-analyzer cargo serde 1.0.144 crate/::serrust-analyzer cargo serde 1.0.144 ser/::SerializeStructVariantrust-analyzer cargo serde 1.0.144 ser/SerializeStructVariant# for SerializeStructVariantrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeStructVariant# {
384 type Okrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeStructVariant][SerializeStructVariant]Ok# = Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#;
385 type Errorrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeStructVariant][SerializeStructVariant]Error# = Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#;
386
387 fn serialize_fieldrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeStructVariant][SerializeStructVariant]serialize_field().<T>(&mut self, key: &'static str, value: &T) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#>
388 where
389 T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde 1.0.144 ser/Serialize#,
390 {
391 self.maprust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeStructVariant#map.
392 .insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().(Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::fromrust-analyzer cargo serde_cbor_2 0.13.0 value/impl#[Value][`From<String>`]from().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().(key)), to_valuerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/to_value().(value)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().);
393 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
394 }
395
396 fn endrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/impl#[SerializeStructVariant][SerializeStructVariant]end().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#> {
397 let mut object = BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`]new().();
398
399 object.insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().(Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::fromrust-analyzer cargo serde_cbor_2 0.13.0 value/impl#[Value][`From<String>`]from().(self.namerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeStructVariant#name.), Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Maprust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Map#(self.maprust-analyzer cargo serde_cbor_2 0.13.0 value/ser/SerializeStructVariant#map.));
400
401 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#::Maprust-analyzer cargo serde_cbor_2 0.13.0 value/Value#Map#(object))
402 }
403 }
404
405 /// Convert a `T` into `serde_cbor_2::Value` which is an enum that can represent
406 /// any valid CBOR data.
407 ///
408 /// ```rust
409 /// # use serde::Serialize;
410 /// #[derive(Serialize)]
411 /// struct User {
412 /// fingerprint: String,
413 /// location: String,
414 /// }
415 ///
416 /// let u = User {
417 /// fingerprint: "0xF9BA143B95FF6D82".to_owned(),
418 /// location: "Menlo Park, CA".to_owned(),
419 /// };
420 ///
421 /// let v = serde_cbor_2::value::to_value(u).unwrap();
422 /// ```
423 #[allow(clippy::needless_pass_by_value)]
424 // Taking by value is more friendly to iterator adapters, option and result
425 pub fn to_valuerust-analyzer cargo serde_cbor_2 0.13.0 value/ser/to_value().<T>(value: T) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Valuerust-analyzer cargo serde_cbor_2 0.13.0 value/Value#, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#>
426 where
427 T: Serializerust-analyzer cargo serde 1.0.144 ser/Serialize#,
428 {
429 value.serializerust-analyzer cargo serde 1.0.144 ser/Serialize#serialize().(Serializerrust-analyzer cargo serde_cbor_2 0.13.0 value/ser/Serializer#)
430 }