Debian Codegraph @

src/ser.rs

raw symbols SCIP
1 use craterust-analyzer cargo schemars 1.2.2 crate/::_alloc_preluderust-analyzer cargo schemars 1.2.2 _alloc_prelude/::*;
2 use craterust-analyzer cargo schemars 1.2.2 crate/::_privaterust-analyzer cargo schemars 1.2.2 _private/::allow_nullrust-analyzer cargo schemars 1.2.2 _private/allow_null().;
3 use craterust-analyzer cargo schemars 1.2.2 crate/::{json_schemarust-analyzer cargo schemars 1.2.2 macros/json_schema!, Schemarust-analyzer cargo schemars 1.2.2 schema/Schema#, SchemaGeneratorrust-analyzer cargo schemars 1.2.2 generate/SchemaGenerator#};
4 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#;
5 use serde_jsonrust-analyzer cargo serde_json 1.0.151 crate/::{Errorrust-analyzer cargo serde_json 1.0.151 error/Error#, Maprust-analyzer cargo serde_json 1.0.151 map/Map#, Valuerust-analyzer cargo serde_json 1.0.151 value/Value#};
6
7 pub(craterust-analyzer cargo schemars 1.2.2 crate/) struct Serializerrust-analyzer cargo schemars 1.2.2 ser/Serializer#<'a> {
8 pub(craterust-analyzer cargo schemars 1.2.2 crate/) generatorrust-analyzer cargo schemars 1.2.2 ser/Serializer#generator.: &'a mut SchemaGeneratorrust-analyzer cargo schemars 1.2.2 generate/SchemaGenerator#,
9 pub(craterust-analyzer cargo schemars 1.2.2 crate/) include_titlerust-analyzer cargo schemars 1.2.2 ser/Serializer#include_title.: bool,
10 }
11
12 pub(craterust-analyzer cargo schemars 1.2.2 crate/) struct SerializeSeqrust-analyzer cargo schemars 1.2.2 ser/SerializeSeq#<'a> {
13 generatorrust-analyzer cargo schemars 1.2.2 ser/SerializeSeq#generator.: &'a mut SchemaGeneratorrust-analyzer cargo schemars 1.2.2 generate/SchemaGenerator#,
14 itemsrust-analyzer cargo schemars 1.2.2 ser/SerializeSeq#items.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Schemarust-analyzer cargo schemars 1.2.2 schema/Schema#>,
15 }
16
17 pub(craterust-analyzer cargo schemars 1.2.2 crate/) struct SerializeTuplerust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#<'a> {
18 generatorrust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#generator.: &'a mut SchemaGeneratorrust-analyzer cargo schemars 1.2.2 generate/SchemaGenerator#,
19 itemsrust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#items.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Schemarust-analyzer cargo schemars 1.2.2 schema/Schema#>,
20 titlerust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#title.: &'static str,
21 }
22
23 pub(craterust-analyzer cargo schemars 1.2.2 crate/) struct SerializeMaprust-analyzer cargo schemars 1.2.2 ser/SerializeMap#<'a> {
24 generatorrust-analyzer cargo schemars 1.2.2 ser/SerializeMap#generator.: &'a mut SchemaGeneratorrust-analyzer cargo schemars 1.2.2 generate/SchemaGenerator#,
25 propertiesrust-analyzer cargo schemars 1.2.2 ser/SerializeMap#properties.: Maprust-analyzer cargo serde_json 1.0.151 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.151 value/Value#>,
26 current_keyrust-analyzer cargo schemars 1.2.2 ser/SerializeMap#current_key.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
27 titlerust-analyzer cargo schemars 1.2.2 ser/SerializeMap#title.: &'static str,
28 }
29
30 macro_rules! forward_to_subschema_forrust-analyzer cargo schemars 1.2.2 ser/forward_to_subschema_for! {
31 ($fn:ident, $ty:ty) => {
32 fn $fn(self, _value: $ty) -> Result<Self::Ok, Self::Error> {
33 Ok(self.generator.subschema_for::<$ty>())
34 }
35 };
36 }
37
38 macro_rules! return_instance_typerust-analyzer cargo schemars 1.2.2 ser/return_instance_type! {
39 ($fn:ident, $ty:ty, $instance_type:expr) => {
40 fn $fn(self, _value: $ty) -> Result<Self::Ok, Self::Error> {
41 Ok(json_schema!({
42 "type": $instance_type
43 }))
44 }
45 };
46 }
47
48 impl<'a> serderust-analyzer cargo serde 1.0.229 crate/::Serializerrust-analyzer cargo serde_core 1.0.229 ser/Serializer# for Serializerrust-analyzer cargo schemars 1.2.2 ser/Serializer#<'a> {
49 type Okrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]Ok# = Schemarust-analyzer cargo schemars 1.2.2 schema/Schema#;
50 type Errorrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]Error# = Errorrust-analyzer cargo serde_json 1.0.151 error/Error#;
51
52 type SerializeSeqrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]SerializeSeq# = SerializeSeqrust-analyzer cargo schemars 1.2.2 ser/SerializeSeq#<'a>;
53 type SerializeTuplerust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]SerializeTuple# = SerializeTuplerust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#<'a>;
54 type SerializeTupleStructrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]SerializeTupleStruct# = SerializeTuplerust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#<'a>;
55 type SerializeTupleVariantrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]SerializeTupleVariant# = Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer];
56 type SerializeMaprust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]SerializeMap# = SerializeMaprust-analyzer cargo schemars 1.2.2 ser/SerializeMap#<'a>;
57 type SerializeStructrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]SerializeStruct# = SerializeMaprust-analyzer cargo schemars 1.2.2 ser/SerializeMap#<'a>;
58 type SerializeStructVariantrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]SerializeStructVariant# = Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer];
59
60 return_instance_typerust-analyzer cargo schemars 1.2.2 ser/return_instance_type!!(serialize_i8rust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_i8()., i8, "integer");
61 return_instance_typerust-analyzer cargo schemars 1.2.2 ser/return_instance_type!!(serialize_i16rust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_i16()., i16, "integer");
62 return_instance_typerust-analyzer cargo schemars 1.2.2 ser/return_instance_type!!(serialize_i32rust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_i32()., i32, "integer");
63 return_instance_typerust-analyzer cargo schemars 1.2.2 ser/return_instance_type!!(serialize_i64rust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_i64()., i64, "integer");
64 return_instance_typerust-analyzer cargo schemars 1.2.2 ser/return_instance_type!!(serialize_i128rust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_i128()., i128, "integer");
65 return_instance_typerust-analyzer cargo schemars 1.2.2 ser/return_instance_type!!(serialize_u8rust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_u8()., u8, "integer");
66 return_instance_typerust-analyzer cargo schemars 1.2.2 ser/return_instance_type!!(serialize_u16rust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_u16()., u16, "integer");
67 return_instance_typerust-analyzer cargo schemars 1.2.2 ser/return_instance_type!!(serialize_u32rust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_u32()., u32, "integer");
68 return_instance_typerust-analyzer cargo schemars 1.2.2 ser/return_instance_type!!(serialize_u64rust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_u64()., u64, "integer");
69 return_instance_typerust-analyzer cargo schemars 1.2.2 ser/return_instance_type!!(serialize_u128rust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_u128()., u128, "integer");
70 return_instance_typerust-analyzer cargo schemars 1.2.2 ser/return_instance_type!!(serialize_f32rust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_f32()., f32, "number");
71 return_instance_typerust-analyzer cargo schemars 1.2.2 ser/return_instance_type!!(serialize_f64rust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_f64()., f64, "number");
72
73 forward_to_subschema_forrust-analyzer cargo schemars 1.2.2 ser/forward_to_subschema_for!!(serialize_boolrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_bool()., bool);
74 forward_to_subschema_forrust-analyzer cargo schemars 1.2.2 ser/forward_to_subschema_for!!(serialize_charrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_char()., char);
75 forward_to_subschema_forrust-analyzer cargo schemars 1.2.2 ser/forward_to_subschema_for!!(serialize_strrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_str()., &str);
76 forward_to_subschema_forrust-analyzer cargo schemars 1.2.2 ser/forward_to_subschema_for!!(serialize_bytesrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_bytes()., &[u8]);
77
78 fn collect_strrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]collect_str().<T>(self, _value: &T) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Okrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Ok#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#>
79 where
80 T: Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#,
81 {
82 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(self.generatorrust-analyzer cargo schemars 1.2.2 ser/Serializer#generator..subschema_forrust-analyzer cargo schemars 1.2.2 generate/impl#[SchemaGenerator]subschema_for().::<&str>())
83 }
84
85 fn collect_maprust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]collect_map().<K, V, I>(self, iter: I) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Okrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Ok#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#>
86 where
87 K: serderust-analyzer cargo serde 1.0.229 crate/::Serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize#,
88 V: serderust-analyzer cargo serde 1.0.229 crate/::Serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize#,
89 I: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# = (K, V)>,
90 {
91 let value_schema = iter
92 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#into_iter().()
93 .try_foldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#try_fold().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |acc, (_, v)| {
94 if acc rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) {
95 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(acc);
96 }
97
98 let schema = v.serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize#serialize().(Serializerrust-analyzer cargo schemars 1.2.2 ser/Serializer# {
99 generatorrust-analyzer cargo schemars 1.2.2 ser/Serializer#generator.: self.generatorrust-analyzer cargo schemars 1.2.2 ser/Serializer#generator.,
100 include_titlerust-analyzer cargo schemars 1.2.2 ser/Serializer#include_title.: false,
101 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
102 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(match &acc {
103 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(schema),
104 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(items) if items rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().&schema => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()),
105 _ => acc,
106 })
107 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/try_trait/Try#branch().
108 .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(true.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
109
110 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(json_schemarust-analyzer cargo schemars 1.2.2 macros/json_schema!!({
111 "type": "object",
112 "additionalProperties": value_schema,
113 }))
114 }
115
116 fn serialize_nonerust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_none().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Okrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Ok#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#> {
117 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(self.generatorrust-analyzer cargo schemars 1.2.2 ser/Serializer#generator..subschema_forrust-analyzer cargo schemars 1.2.2 generate/impl#[SchemaGenerator]subschema_for().::<Valuerust-analyzer cargo serde_json 1.0.151 value/Value#>())
118 }
119
120 fn serialize_unitrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_unit().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Okrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Ok#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#> {
121 self.serialize_nonerust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_none().()
122 }
123
124 fn serialize_somerust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_some().<T>(self, value: &T) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Okrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Ok#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#>
125 where
126 T: serderust-analyzer cargo serde 1.0.229 crate/::Serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#,
127 {
128 let mut schema = value.serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize#serialize().(Serializerrust-analyzer cargo schemars 1.2.2 ser/Serializer# {
129 generatorrust-analyzer cargo schemars 1.2.2 ser/Serializer#generator.: self.generatorrust-analyzer cargo schemars 1.2.2 ser/Serializer#generator.,
130 include_titlerust-analyzer cargo schemars 1.2.2 ser/Serializer#include_title.: false,
131 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
132
133 allow_nullrust-analyzer cargo schemars 1.2.2 _private/allow_null().(self.generatorrust-analyzer cargo schemars 1.2.2 ser/Serializer#generator., &mut schema);
134
135 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(schema)
136 }
137
138 fn serialize_unit_structrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_unit_struct().(self, _name: &'static str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Okrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Ok#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#> {
139 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(self.generatorrust-analyzer cargo schemars 1.2.2 ser/Serializer#generator..subschema_forrust-analyzer cargo schemars 1.2.2 generate/impl#[SchemaGenerator]subschema_for().::<()>())
140 }
141
142 fn serialize_unit_variantrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_unit_variant().(
143 self,
144 _name: &'static str,
145 _variant_index: u32,
146 _variant: &'static str,
147 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Okrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Ok#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#> {
148 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(true.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())
149 }
150
151 fn serialize_newtype_structrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_newtype_struct().<T>(
152 self,
153 name: &'static str,
154 value: &T,
155 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Okrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Ok#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#>
156 where
157 T: serderust-analyzer cargo serde 1.0.229 crate/::Serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#,
158 {
159 let include_title = self.include_titlerust-analyzer cargo schemars 1.2.2 ser/Serializer#include_title.;
160 let mut schema = value.serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize#serialize().(self)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
161
162 if include_title && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().name.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
163 schema.insertrust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]insert().("title".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), name.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
164 }
165
166 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(schema)
167 }
168
169 fn serialize_newtype_variantrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_newtype_variant().<T>(
170 self,
171 _name: &'static str,
172 _variant_index: u32,
173 _variant: &'static str,
174 _value: &T,
175 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Okrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Ok#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#>
176 where
177 T: serderust-analyzer cargo serde 1.0.229 crate/::Serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#,
178 {
179 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(true.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())
180 }
181
182 fn serialize_seqrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][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 schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::SerializeSeqrust-analyzer cargo serde_core 1.0.229 ser/Serializer#SerializeSeq#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#> {
183 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(SerializeSeqrust-analyzer cargo schemars 1.2.2 ser/SerializeSeq# {
184 generatorrust-analyzer cargo schemars 1.2.2 ser/SerializeSeq#generator.: self.generatorrust-analyzer cargo schemars 1.2.2 ser/Serializer#generator.,
185 itemsrust-analyzer cargo schemars 1.2.2 ser/SerializeSeq#items.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(),
186 })
187 }
188
189 fn serialize_tuplerust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_tuple().(self, len: usize) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::SerializeTuplerust-analyzer cargo serde_core 1.0.229 ser/Serializer#SerializeTuple#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#> {
190 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(SerializeTuplerust-analyzer cargo schemars 1.2.2 ser/SerializeTuple# {
191 generatorrust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#generator.: self.generatorrust-analyzer cargo schemars 1.2.2 ser/Serializer#generator.,
192 itemsrust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#items.: 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),
193 titlerust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#title.: "",
194 })
195 }
196
197 fn serialize_tuple_structrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_tuple_struct().(
198 self,
199 name: &'static str,
200 len: usize,
201 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::SerializeTupleStructrust-analyzer cargo serde_core 1.0.229 ser/Serializer#SerializeTupleStruct#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#> {
202 let title = if self.include_titlerust-analyzer cargo schemars 1.2.2 ser/Serializer#include_title. { name } else { "" };
203 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(SerializeTuplerust-analyzer cargo schemars 1.2.2 ser/SerializeTuple# {
204 generatorrust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#generator.: self.generatorrust-analyzer cargo schemars 1.2.2 ser/Serializer#generator.,
205 itemsrust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#items.: 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),
206 titlerust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#title.,
207 })
208 }
209
210 fn serialize_tuple_variantrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_tuple_variant().(
211 self,
212 _name: &'static str,
213 _variant_index: u32,
214 _variant: &'static str,
215 _len: usize,
216 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::SerializeTupleVariantrust-analyzer cargo serde_core 1.0.229 ser/Serializer#SerializeTupleVariant#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#> {
217 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(self)
218 }
219
220 fn serialize_maprust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][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 schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::SerializeMaprust-analyzer cargo serde_core 1.0.229 ser/Serializer#SerializeMap#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#> {
221 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(SerializeMaprust-analyzer cargo schemars 1.2.2 ser/SerializeMap# {
222 generatorrust-analyzer cargo schemars 1.2.2 ser/SerializeMap#generator.: self.generatorrust-analyzer cargo schemars 1.2.2 ser/Serializer#generator.,
223 propertiesrust-analyzer cargo schemars 1.2.2 ser/SerializeMap#properties.: Maprust-analyzer cargo serde_json 1.0.151 map/Map#::newrust-analyzer cargo serde_json 1.0.151 map/impl#[`Map<String, Value>`]new().(),
224 current_keyrust-analyzer cargo schemars 1.2.2 ser/SerializeMap#current_key.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
225 titlerust-analyzer cargo schemars 1.2.2 ser/SerializeMap#title.: "",
226 })
227 }
228
229 fn serialize_structrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_struct().(
230 self,
231 name: &'static str,
232 _len: usize,
233 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::SerializeStructrust-analyzer cargo serde_core 1.0.229 ser/Serializer#SerializeStruct#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#> {
234 let title = if self.include_titlerust-analyzer cargo schemars 1.2.2 ser/Serializer#include_title. { name } else { "" };
235 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(SerializeMaprust-analyzer cargo schemars 1.2.2 ser/SerializeMap# {
236 generatorrust-analyzer cargo schemars 1.2.2 ser/SerializeMap#generator.: self.generatorrust-analyzer cargo schemars 1.2.2 ser/Serializer#generator.,
237 propertiesrust-analyzer cargo schemars 1.2.2 ser/SerializeMap#properties.: Maprust-analyzer cargo serde_json 1.0.151 map/Map#::newrust-analyzer cargo serde_json 1.0.151 map/impl#[`Map<String, Value>`]new().(),
238 current_keyrust-analyzer cargo schemars 1.2.2 ser/SerializeMap#current_key.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
239 titlerust-analyzer cargo schemars 1.2.2 ser/SerializeMap#title.,
240 })
241 }
242
243 fn serialize_struct_variantrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]serialize_struct_variant().(
244 self,
245 _name: &'static str,
246 _variant_index: u32,
247 _variant: &'static str,
248 _len: usize,
249 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::SerializeStructVariantrust-analyzer cargo serde_core 1.0.229 ser/Serializer#SerializeStructVariant#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'a>`][Serializer]::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#> {
250 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(self)
251 }
252 }
253
254 impl serderust-analyzer cargo serde 1.0.229 crate/::serrust-analyzer cargo serde_core 1.0.229 ser/::SerializeTupleVariantrust-analyzer cargo serde_core 1.0.229 ser/SerializeTupleVariant# for Serializerrust-analyzer cargo schemars 1.2.2 ser/Serializer#<'_> {
255 type Okrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'_>`][SerializeTupleVariant]Ok# = Schemarust-analyzer cargo schemars 1.2.2 schema/Schema#;
256 type Errorrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'_>`][SerializeTupleVariant]Error# = Errorrust-analyzer cargo serde_json 1.0.151 error/Error#;
257
258 fn serialize_fieldrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'_>`][SerializeTupleVariant]serialize_field().<T>(&mut self, _value: &T) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'_>`][SerializeTupleVariant]::Errorrust-analyzer cargo serde_core 1.0.229 ser/SerializeTupleVariant#Error#>
259 where
260 T: serderust-analyzer cargo serde 1.0.229 crate/::Serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#,
261 {
262 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
263 }
264
265 fn endrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'_>`][SerializeTupleVariant]end().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'_>`][SerializeTupleVariant]::Okrust-analyzer cargo serde_core 1.0.229 ser/SerializeTupleVariant#Ok#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'_>`][SerializeTupleVariant]::Errorrust-analyzer cargo serde_core 1.0.229 ser/SerializeTupleVariant#Error#> {
266 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(true.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())
267 }
268 }
269
270 impl serderust-analyzer cargo serde 1.0.229 crate/::serrust-analyzer cargo serde_core 1.0.229 ser/::SerializeStructVariantrust-analyzer cargo serde_core 1.0.229 ser/SerializeStructVariant# for Serializerrust-analyzer cargo schemars 1.2.2 ser/Serializer#<'_> {
271 type Okrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'_>`][SerializeStructVariant]Ok# = Schemarust-analyzer cargo schemars 1.2.2 schema/Schema#;
272 type Errorrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'_>`][SerializeStructVariant]Error# = Errorrust-analyzer cargo serde_json 1.0.151 error/Error#;
273
274 fn serialize_fieldrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'_>`][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#<(), Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'_>`][SerializeStructVariant]::Errorrust-analyzer cargo serde_core 1.0.229 ser/SerializeStructVariant#Error#>
275 where
276 T: serderust-analyzer cargo serde 1.0.229 crate/::Serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#,
277 {
278 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
279 }
280
281 fn endrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'_>`][SerializeStructVariant]end().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'_>`][SerializeStructVariant]::Okrust-analyzer cargo serde_core 1.0.229 ser/SerializeStructVariant#Ok#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`Serializer<'_>`][SerializeStructVariant]::Errorrust-analyzer cargo serde_core 1.0.229 ser/SerializeStructVariant#Error#> {
282 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(true.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())
283 }
284 }
285
286 impl serderust-analyzer cargo serde 1.0.229 crate/::serrust-analyzer cargo serde_core 1.0.229 ser/::SerializeSeqrust-analyzer cargo serde_core 1.0.229 ser/SerializeSeq# for SerializeSeqrust-analyzer cargo schemars 1.2.2 ser/SerializeSeq#<'_> {
287 type Okrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeSeq<'_>`][SerializeSeq]Ok# = Schemarust-analyzer cargo schemars 1.2.2 schema/Schema#;
288 type Errorrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeSeq<'_>`][SerializeSeq]Error# = Errorrust-analyzer cargo serde_json 1.0.151 error/Error#;
289
290 fn serialize_elementrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeSeq<'_>`][SerializeSeq]serialize_element().<T>(&mut self, value: &T) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeSeq<'_>`][SerializeSeq]::Errorrust-analyzer cargo serde_core 1.0.229 ser/SerializeSeq#Error#>
291 where
292 T: serderust-analyzer cargo serde 1.0.229 crate/::Serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#,
293 {
294 if self.itemsrust-analyzer cargo schemars 1.2.2 ser/SerializeSeq#items..firstrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]first().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&true.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) {
295 // Schema already allows any value, so no point in extending it
296 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(());
297 }
298
299 let schema = value.serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize#serialize().(Serializerrust-analyzer cargo schemars 1.2.2 ser/Serializer# {
300 generatorrust-analyzer cargo schemars 1.2.2 ser/Serializer#generator.: self.generatorrust-analyzer cargo schemars 1.2.2 ser/SerializeSeq#generator.,
301 include_titlerust-analyzer cargo schemars 1.2.2 ser/Serializer#include_title.: false,
302 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
303
304 if schema rust-analyzer cargo schemars 1.2.2 schema/impl#[Schema][`PartialEq<bool>`]eq().==rust-analyzer cargo schemars 1.2.2 schema/impl#[Schema][`PartialEq<bool>`]eq(). rust-analyzer cargo schemars 1.2.2 schema/impl#[Schema][`PartialEq<bool>`]eq().true {
305 self.itemsrust-analyzer cargo schemars 1.2.2 ser/SerializeSeq#items. = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![schema];
306 } else if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.itemsrust-analyzer cargo schemars 1.2.2 ser/SerializeSeq#items..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&schema) {
307 self.itemsrust-analyzer cargo schemars 1.2.2 ser/SerializeSeq#items..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(schema);
308 }
309
310 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
311 }
312
313 fn endrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeSeq<'_>`][SerializeSeq]end().(mut self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeSeq<'_>`][SerializeSeq]::Okrust-analyzer cargo serde_core 1.0.229 ser/SerializeSeq#Ok#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeSeq<'_>`][SerializeSeq]::Errorrust-analyzer cargo serde_core 1.0.229 ser/SerializeSeq#Error#> {
314 let items = match self.itemsrust-analyzer cargo schemars 1.2.2 ser/SerializeSeq#items..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() {
315 0 => true.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
316 1 => self.itemsrust-analyzer cargo schemars 1.2.2 ser/SerializeSeq#items..removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]remove().(0),
317 _ => json_schemarust-analyzer cargo schemars 1.2.2 macros/json_schema!!({
318 "anyOf": self.itemsrust-analyzer cargo schemars 1.2.2 ser/SerializeSeq#items.
319 }),
320 };
321
322 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(json_schemarust-analyzer cargo schemars 1.2.2 macros/json_schema!!({
323 "type": "array",
324 "items": items
325 }))
326 }
327 }
328
329 impl serderust-analyzer cargo serde 1.0.229 crate/::serrust-analyzer cargo serde_core 1.0.229 ser/::SerializeTuplerust-analyzer cargo serde_core 1.0.229 ser/SerializeTuple# for SerializeTuplerust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#<'_> {
330 type Okrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeTuple<'_>`][SerializeTuple]Ok# = Schemarust-analyzer cargo schemars 1.2.2 schema/Schema#;
331 type Errorrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeTuple<'_>`][SerializeTuple]Error# = Errorrust-analyzer cargo serde_json 1.0.151 error/Error#;
332
333 fn serialize_elementrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeTuple<'_>`][SerializeTuple]serialize_element().<T>(&mut self, value: &T) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeTuple<'_>`][SerializeTuple]::Errorrust-analyzer cargo serde_core 1.0.229 ser/SerializeTuple#Error#>
334 where
335 T: serderust-analyzer cargo serde 1.0.229 crate/::Serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#,
336 {
337 let schema = value.serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize#serialize().(Serializerrust-analyzer cargo schemars 1.2.2 ser/Serializer# {
338 generatorrust-analyzer cargo schemars 1.2.2 ser/Serializer#generator.: self.generatorrust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#generator.,
339 include_titlerust-analyzer cargo schemars 1.2.2 ser/Serializer#include_title.: false,
340 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
341 self.itemsrust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#items..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(schema);
342 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
343 }
344
345 fn endrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeTuple<'_>`][SerializeTuple]end().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeTuple<'_>`][SerializeTuple]::Okrust-analyzer cargo serde_core 1.0.229 ser/SerializeTuple#Ok#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeTuple<'_>`][SerializeTuple]::Errorrust-analyzer cargo serde_core 1.0.229 ser/SerializeTuple#Error#> {
346 let len = self.itemsrust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#items..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().();
347 let mut schema = json_schemarust-analyzer cargo schemars 1.2.2 macros/json_schema!!({
348 "type": "array",
349 "prefixItems": self.itemsrust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#items.,
350 "maxItems": len,
351 "minItems": len,
352 });
353
354 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.titlerust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#title..is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
355 schema
356 .ensure_objectrust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]ensure_object().()
357 .insertrust-analyzer cargo serde_json 1.0.151 map/impl#[`Map<String, Value>`]insert().("title".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), self.titlerust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#title..intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
358 }
359
360 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(schema)
361 }
362 }
363
364 impl serderust-analyzer cargo serde 1.0.229 crate/::serrust-analyzer cargo serde_core 1.0.229 ser/::SerializeTupleStructrust-analyzer cargo serde_core 1.0.229 ser/SerializeTupleStruct# for SerializeTuplerust-analyzer cargo schemars 1.2.2 ser/SerializeTuple#<'_> {
365 type Okrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeTuple<'_>`][SerializeTupleStruct]Ok# = Schemarust-analyzer cargo schemars 1.2.2 schema/Schema#;
366 type Errorrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeTuple<'_>`][SerializeTupleStruct]Error# = Errorrust-analyzer cargo serde_json 1.0.151 error/Error#;
367
368 fn serialize_fieldrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeTuple<'_>`][SerializeTupleStruct]serialize_field().<T>(&mut self, value: &T) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeTuple<'_>`][SerializeTupleStruct]::Errorrust-analyzer cargo serde_core 1.0.229 ser/SerializeTupleStruct#Error#>
369 where
370 T: serderust-analyzer cargo serde 1.0.229 crate/::Serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#,
371 {
372 serderust-analyzer cargo serde 1.0.229 crate/::serrust-analyzer cargo serde_core 1.0.229 ser/::SerializeTuplerust-analyzer cargo serde_core 1.0.229 ser/SerializeTuple#::serialize_elementrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeTuple<'_>`][SerializeTuple]serialize_element().(self, value)
373 }
374
375 fn endrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeTuple<'_>`][SerializeTupleStruct]end().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeTuple<'_>`][SerializeTupleStruct]::Okrust-analyzer cargo serde_core 1.0.229 ser/SerializeTupleStruct#Ok#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeTuple<'_>`][SerializeTupleStruct]::Errorrust-analyzer cargo serde_core 1.0.229 ser/SerializeTupleStruct#Error#> {
376 serderust-analyzer cargo serde 1.0.229 crate/::serrust-analyzer cargo serde_core 1.0.229 ser/::SerializeTuplerust-analyzer cargo serde_core 1.0.229 ser/SerializeTuple#::endrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeTuple<'_>`][SerializeTuple]end().(self)
377 }
378 }
379
380 impl serderust-analyzer cargo serde 1.0.229 crate/::serrust-analyzer cargo serde_core 1.0.229 ser/::SerializeMaprust-analyzer cargo serde_core 1.0.229 ser/SerializeMap# for SerializeMaprust-analyzer cargo schemars 1.2.2 ser/SerializeMap#<'_> {
381 type Okrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeMap<'_>`][SerializeMap]Ok# = Schemarust-analyzer cargo schemars 1.2.2 schema/Schema#;
382 type Errorrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeMap<'_>`][SerializeMap]Error# = Errorrust-analyzer cargo serde_json 1.0.151 error/Error#;
383
384 fn serialize_keyrust-analyzer cargo schemars 1.2.2 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#<(), Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeMap<'_>`][SerializeMap]::Errorrust-analyzer cargo serde_core 1.0.229 ser/SerializeMap#Error#>
385 where
386 T: serderust-analyzer cargo serde 1.0.229 crate/::Serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#,
387 {
388 // FIXME this is too lenient - we should return an error if serde_json
389 // doesn't allow T to be a key of a map.
390 let json = serde_jsonrust-analyzer cargo serde_json 1.0.151 crate/::to_stringrust-analyzer cargo serde_json 1.0.151 ser/to_string().(key)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
391 self.current_keyrust-analyzer cargo schemars 1.2.2 ser/SerializeMap#current_key. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(
392 json.trim_start_matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_start_matches().('"')
393 .trim_end_matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_end_matches().('"')
394 .to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
395 );
396
397 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
398 }
399
400 fn serialize_valuerust-analyzer cargo schemars 1.2.2 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#<(), Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeMap<'_>`][SerializeMap]::Errorrust-analyzer cargo serde_core 1.0.229 ser/SerializeMap#Error#>
401 where
402 T: serderust-analyzer cargo serde 1.0.229 crate/::Serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#,
403 {
404 let key = self.current_keyrust-analyzer cargo schemars 1.2.2 ser/SerializeMap#current_key..takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]take().().unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().();
405 let schema = value.serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize#serialize().(Serializerrust-analyzer cargo schemars 1.2.2 ser/Serializer# {
406 generatorrust-analyzer cargo schemars 1.2.2 ser/Serializer#generator.: self.generatorrust-analyzer cargo schemars 1.2.2 ser/SerializeMap#generator.,
407 include_titlerust-analyzer cargo schemars 1.2.2 ser/Serializer#include_title.: false,
408 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
409 self.propertiesrust-analyzer cargo schemars 1.2.2 ser/SerializeMap#properties..insertrust-analyzer cargo serde_json 1.0.151 map/impl#[`Map<String, Value>`]insert().(key, schema.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
410
411 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
412 }
413
414 fn endrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeMap<'_>`][SerializeMap]end().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeMap<'_>`][SerializeMap]::Okrust-analyzer cargo serde_core 1.0.229 ser/SerializeMap#Ok#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeMap<'_>`][SerializeMap]::Errorrust-analyzer cargo serde_core 1.0.229 ser/SerializeMap#Error#> {
415 let mut schema = json_schemarust-analyzer cargo schemars 1.2.2 macros/json_schema!!({
416 "type": "object",
417 "properties": self.propertiesrust-analyzer cargo schemars 1.2.2 ser/SerializeMap#properties.,
418 });
419
420 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.titlerust-analyzer cargo schemars 1.2.2 ser/SerializeMap#title..is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
421 schema
422 .ensure_objectrust-analyzer cargo schemars 1.2.2 schema/impl#[Schema]ensure_object().()
423 .insertrust-analyzer cargo serde_json 1.0.151 map/impl#[`Map<String, Value>`]insert().("title".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), self.titlerust-analyzer cargo schemars 1.2.2 ser/SerializeMap#title..intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
424 }
425
426 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(schema)
427 }
428 }
429
430 impl serderust-analyzer cargo serde 1.0.229 crate/::serrust-analyzer cargo serde_core 1.0.229 ser/::SerializeStructrust-analyzer cargo serde_core 1.0.229 ser/SerializeStruct# for SerializeMaprust-analyzer cargo schemars 1.2.2 ser/SerializeMap#<'_> {
431 type Okrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeMap<'_>`][SerializeStruct]Ok# = Schemarust-analyzer cargo schemars 1.2.2 schema/Schema#;
432 type Errorrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeMap<'_>`][SerializeStruct]Error# = Errorrust-analyzer cargo serde_json 1.0.151 error/Error#;
433
434 fn serialize_fieldrust-analyzer cargo schemars 1.2.2 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#<(), Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeMap<'_>`][SerializeStruct]::Errorrust-analyzer cargo serde_core 1.0.229 ser/SerializeStruct#Error#>
435 where
436 T: serderust-analyzer cargo serde 1.0.229 crate/::Serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#,
437 {
438 let prop_schema = value.serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize#serialize().(Serializerrust-analyzer cargo schemars 1.2.2 ser/Serializer# {
439 generatorrust-analyzer cargo schemars 1.2.2 ser/Serializer#generator.: self.generatorrust-analyzer cargo schemars 1.2.2 ser/SerializeMap#generator.,
440 include_titlerust-analyzer cargo schemars 1.2.2 ser/Serializer#include_title.: false,
441 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
442 self.propertiesrust-analyzer cargo schemars 1.2.2 ser/SerializeMap#properties..insertrust-analyzer cargo serde_json 1.0.151 map/impl#[`Map<String, Value>`]insert().(key.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), prop_schema.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
443
444 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
445 }
446
447 fn endrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeMap<'_>`][SerializeStruct]end().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeMap<'_>`][SerializeStruct]::Okrust-analyzer cargo serde_core 1.0.229 ser/SerializeStruct#Ok#, Selfrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeMap<'_>`][SerializeStruct]::Errorrust-analyzer cargo serde_core 1.0.229 ser/SerializeStruct#Error#> {
448 serderust-analyzer cargo serde 1.0.229 crate/::serrust-analyzer cargo serde_core 1.0.229 ser/::SerializeMaprust-analyzer cargo serde_core 1.0.229 ser/SerializeMap#::endrust-analyzer cargo schemars 1.2.2 ser/impl#[`SerializeMap<'_>`][SerializeMap]end().(self)
449 }
450 }