Debian Codegraph @

tests/integration/enums_ref_variants.rs

raw symbols SCIP
1 use craterust-analyzer cargo schemars 1.2.2 crate/::preluderust-analyzer cargo schemars 1.2.2 prelude/::*;
2 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#;
3
4 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:, Deserializerust-analyzer cargo serde_derive 1.0.229 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.229 Serialize:)]
5 struct UnitStructrust-analyzer cargo schemars 1.2.2 enums_ref_variants/UnitStruct#;
6
7 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:, Deserializerust-analyzer cargo serde_derive 1.0.229 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.229 Serialize:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)]
8 struct Structrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Struct# {
9 foorust-analyzer cargo schemars 1.2.2 enums_ref_variants/Struct#foo.: i32,
10 barrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Struct#bar.: bool,
11 }
12
13 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:, Deserializerust-analyzer cargo serde_derive 1.0.229 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.229 Serialize:)]
14 #[serde(rename_all = "camelCase")]
15 #[schemars(_unstable_ref_variants)]
16 enum Externalrust-analyzer cargo schemars 1.2.2 enums_ref_variants/External# {
17 UnitOnerust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#UnitOne#,
18 StringMaprust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#StringMap#(BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>),
19 UnitStructNewTyperust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#UnitStructNewType#(UnitStructrust-analyzer cargo schemars 1.2.2 enums_ref_variants/UnitStruct#),
20 StructNewTyperust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#StructNewType#(Structrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Struct#),
21 Structrust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#Struct# {
22 foorust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#Struct#foo.: i32,
23 barrust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#Struct#bar.: bool,
24 },
25 Tuplerust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#Tuple#(i32, bool),
26 UnitTworust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#UnitTwo#,
27 #[serderust-analyzer cargo schemars_derive 1.2.2 serde:(with = "unit_variant_as_u64")]
28 #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(with = "u64")]
29 UnitAsIntrust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#UnitAsInt#,
30 #[serderust-analyzer cargo schemars_derive 1.2.2 serde:(with = "tuple_variant_as_str")]
31 #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(schema_with = "tuple_variant_as_str::json_schema")]
32 TupleAsStrrust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#TupleAsStr#(i32, bool),
33 }
34
35 impl Externalrust-analyzer cargo schemars 1.2.2 enums_ref_variants/External# {
36 fn valuesrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[External]values().() -> impl 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# = Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[External]> {
37 [
38 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[External]::UnitOnerust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#UnitOne#,
39 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[External]::StringMaprust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#StringMap#(
40 [("hello".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), "world".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().())]
41 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
42 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(),
43 ),
44 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[External]::UnitStructNewTyperust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#UnitStructNewType#(UnitStructrust-analyzer cargo schemars 1.2.2 enums_ref_variants/UnitStruct#),
45 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[External]::StructNewTyperust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#StructNewType#(Structrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Struct# {
46 foorust-analyzer cargo schemars 1.2.2 enums_ref_variants/Struct#foo.: 123,
47 barrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Struct#bar.: true,
48 }),
49 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[External]::Structrust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#Struct# {
50 foorust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#Struct#foo.: 123,
51 barrust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#Struct#bar.: true,
52 },
53 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[External]::Tuplerust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#Tuple#(456, false),
54 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[External]::UnitTworust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#UnitTwo#,
55 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[External]::UnitAsIntrust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#UnitAsInt#,
56 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[External]::TupleAsStrrust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#TupleAsStr#(789, true),
57 ]
58 }
59 }
60
61 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:, Deserializerust-analyzer cargo serde_derive 1.0.229 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.229 Serialize:)]
62 #[serde(tag = "tag")]
63 #[schemars(_unstable_ref_variants)]
64 enum Internalrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal# {
65 UnitOnerust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal#UnitOne#,
66 StringMaprust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal#StringMap#(BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>),
67 UnitStructNewTyperust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal#UnitStructNewType#(UnitStructrust-analyzer cargo schemars 1.2.2 enums_ref_variants/UnitStruct#),
68 StructNewTyperust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal#StructNewType#(Structrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Struct#),
69 Structrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal#Struct# { foorust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal#Struct#foo.: i32, barrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal#Struct#bar.: bool },
70 // Internally-tagged enums don't support tuple variants
71 // Tuple(i32, bool),
72 UnitTworust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal#UnitTwo#,
73 // Internally-tagged enum variants don't support non-object "payloads"
74 // #[serde(with = "unit_variant_as_u64")]
75 // #[schemars(with = "u64")]
76 // UnitAsInt,
77 // Internally-tagged enums don't support tuple variants
78 // #[serde(with = "tuple_variant_as_str")]
79 // #[schemars(schema_with = "tuple_variant_as_str::json_schema")]
80 // TupleAsStr(i32, bool),
81 }
82
83 impl Internalrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal# {
84 fn valuesrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Internal]values().() -> impl 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# = Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Internal]> {
85 [
86 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Internal]::UnitOnerust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal#UnitOne#,
87 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Internal]::StringMaprust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal#StringMap#(
88 [("hello".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), "world".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().())]
89 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
90 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(),
91 ),
92 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Internal]::UnitStructNewTyperust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal#UnitStructNewType#(UnitStructrust-analyzer cargo schemars 1.2.2 enums_ref_variants/UnitStruct#),
93 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Internal]::StructNewTyperust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal#StructNewType#(Structrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Struct# {
94 foorust-analyzer cargo schemars 1.2.2 enums_ref_variants/Struct#foo.: 123,
95 barrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Struct#bar.: true,
96 }),
97 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Internal]::Structrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal#Struct# {
98 foorust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal#Struct#foo.: 123,
99 barrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal#Struct#bar.: true,
100 },
101 // Self::Tuple(456, false),
102 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Internal]::UnitTworust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal#UnitTwo#,
103 // Self::UnitAsInt,
104 // Self::TupleAsStr(789, true),
105 ]
106 }
107 }
108
109 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:, Deserializerust-analyzer cargo serde_derive 1.0.229 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.229 Serialize:)]
110 #[serde(tag = "tag", content = "content")]
111 #[schemars(_unstable_ref_variants)]
112 enum Adjacentrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent# {
113 UnitOnerust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#UnitOne#,
114 StringMaprust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#StringMap#(BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>),
115 UnitStructNewTyperust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#UnitStructNewType#(UnitStructrust-analyzer cargo schemars 1.2.2 enums_ref_variants/UnitStruct#),
116 StructNewTyperust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#StructNewType#(Structrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Struct#),
117 Structrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#Struct# {
118 foorust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#Struct#foo.: i32,
119 barrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#Struct#bar.: bool,
120 },
121 Tuplerust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#Tuple#(i32, bool),
122 UnitTworust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#UnitTwo#,
123 #[serderust-analyzer cargo schemars_derive 1.2.2 serde:(with = "unit_variant_as_u64")]
124 #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(with = "u64")]
125 UnitAsIntrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#UnitAsInt#,
126 #[serderust-analyzer cargo schemars_derive 1.2.2 serde:(with = "tuple_variant_as_str")]
127 #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(schema_with = "tuple_variant_as_str::json_schema")]
128 TupleAsStrrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#TupleAsStr#(i32, bool),
129 }
130
131 impl Adjacentrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent# {
132 fn valuesrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Adjacent]values().() -> impl 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# = Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Adjacent]> {
133 [
134 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Adjacent]::UnitOnerust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#UnitOne#,
135 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Adjacent]::StringMaprust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#StringMap#(
136 [("hello".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), "world".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().())]
137 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
138 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(),
139 ),
140 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Adjacent]::UnitStructNewTyperust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#UnitStructNewType#(UnitStructrust-analyzer cargo schemars 1.2.2 enums_ref_variants/UnitStruct#),
141 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Adjacent]::StructNewTyperust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#StructNewType#(Structrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Struct# {
142 foorust-analyzer cargo schemars 1.2.2 enums_ref_variants/Struct#foo.: 123,
143 barrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Struct#bar.: true,
144 }),
145 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Adjacent]::Structrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#Struct# {
146 foorust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#Struct#foo.: 123,
147 barrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#Struct#bar.: true,
148 },
149 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Adjacent]::Tuplerust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#Tuple#(456, false),
150 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Adjacent]::UnitTworust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#UnitTwo#,
151 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Adjacent]::UnitAsIntrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#UnitAsInt#,
152 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Adjacent]::TupleAsStrrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#TupleAsStr#(789, true),
153 ]
154 }
155 }
156
157 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:, Deserializerust-analyzer cargo serde_derive 1.0.229 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.229 Serialize:)]
158 #[serde(untagged)]
159 #[schemars(_unstable_ref_variants)]
160 enum Untaggedrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged# {
161 UnitOnerust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#UnitOne#,
162 StringMaprust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#StringMap#(BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>),
163 UnitStructNewTyperust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#UnitStructNewType#(UnitStructrust-analyzer cargo schemars 1.2.2 enums_ref_variants/UnitStruct#),
164 StructNewTyperust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#StructNewType#(Structrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Struct#),
165 Structrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#Struct# {
166 foorust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#Struct#foo.: i32,
167 barrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#Struct#bar.: bool,
168 },
169 Tuplerust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#Tuple#(i32, bool),
170 UnitTworust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#UnitTwo#,
171 #[serderust-analyzer cargo schemars_derive 1.2.2 serde:(with = "unit_variant_as_u64")]
172 #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(with = "u64")]
173 UnitAsIntrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#UnitAsInt#,
174 #[serderust-analyzer cargo schemars_derive 1.2.2 serde:(with = "tuple_variant_as_str")]
175 #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(schema_with = "tuple_variant_as_str::json_schema")]
176 TupleAsStrrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#TupleAsStr#(i32, bool),
177 }
178
179 impl Untaggedrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged# {
180 fn valuesrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Untagged]values().() -> impl 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# = Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Untagged]> {
181 [
182 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Untagged]::UnitOnerust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#UnitOne#,
183 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Untagged]::StringMaprust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#StringMap#(
184 [("hello".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), "world".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().())]
185 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
186 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(),
187 ),
188 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Untagged]::UnitStructNewTyperust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#UnitStructNewType#(UnitStructrust-analyzer cargo schemars 1.2.2 enums_ref_variants/UnitStruct#),
189 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Untagged]::StructNewTyperust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#StructNewType#(Structrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Struct# {
190 foorust-analyzer cargo schemars 1.2.2 enums_ref_variants/Struct#foo.: 123,
191 barrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Struct#bar.: true,
192 }),
193 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Untagged]::Structrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#Struct# {
194 foorust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#Struct#foo.: 123,
195 barrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#Struct#bar.: true,
196 },
197 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Untagged]::Tuplerust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#Tuple#(456, false),
198 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Untagged]::UnitTworust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#UnitTwo#,
199 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Untagged]::UnitAsIntrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#UnitAsInt#,
200 Selfrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Untagged]::TupleAsStrrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#TupleAsStr#(789, true),
201 ]
202 }
203 }
204
205 mod unit_variant_as_u64rust-analyzer cargo schemars 1.2.2 enums_ref_variants/unit_variant_as_u64/ {
206 pub(superrust-analyzer cargo schemars 1.2.2 enums_ref_variants/) fn serializerust-analyzer cargo schemars 1.2.2 enums_ref_variants/unit_variant_as_u64/serialize().<S>(ser: S) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<S::Okrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Ok#, S::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#>
207 where
208 S: serderust-analyzer cargo serde 1.0.229 crate/::Serializerrust-analyzer cargo serde_core 1.0.229 ser/Serializer#,
209 {
210 ser.serialize_u64rust-analyzer cargo serde_core 1.0.229 ser/Serializer#serialize_u64().(42)
211 }
212
213 pub(superrust-analyzer cargo schemars 1.2.2 enums_ref_variants/) fn deserializerust-analyzer cargo schemars 1.2.2 enums_ref_variants/unit_variant_as_u64/deserialize().<'de, D>(deser: D) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), D::Errorrust-analyzer cargo serde_core 1.0.229 de/Deserializer#Error#>
214 where
215 D: serderust-analyzer cargo serde 1.0.229 crate/::Deserializerrust-analyzer cargo serde_core 1.0.229 de/Deserializer#<'de>,
216 {
217 use serderust-analyzer cargo serde 1.0.229 crate/::derust-analyzer cargo serde_core 1.0.229 de/::Deserializerust-analyzer cargo serde_core 1.0.229 de/Deserialize#;
218
219 u64::deserializerust-analyzer cargo serde_core 1.0.229 de/impls/impl#[u64][`Deserialize<'de>`]deserialize().(deser).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|_| ())
220 }
221 }
222
223 mod tuple_variant_as_strrust-analyzer cargo schemars 1.2.2 enums_ref_variants/tuple_variant_as_str/ {
224 pub(superrust-analyzer cargo schemars 1.2.2 enums_ref_variants/) fn serializerust-analyzer cargo schemars 1.2.2 enums_ref_variants/tuple_variant_as_str/serialize().<S>(i: &i32, b: &bool, ser: S) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<S::Okrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Ok#, S::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#>
225 where
226 S: serderust-analyzer cargo serde 1.0.229 crate/::Serializerrust-analyzer cargo serde_core 1.0.229 ser/Serializer#,
227 {
228 ser.collect_strrust-analyzer cargo serde_core 1.0.229 ser/Serializer#collect_str().(&format_argsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/format_args!!("{i} {b}"))
229 }
230
231 pub(superrust-analyzer cargo schemars 1.2.2 enums_ref_variants/) fn deserializerust-analyzer cargo schemars 1.2.2 enums_ref_variants/tuple_variant_as_str/deserialize().<'de, D>(deser: D) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(i32, bool), D::Errorrust-analyzer cargo serde_core 1.0.229 de/Deserializer#Error#>
232 where
233 D: serderust-analyzer cargo serde 1.0.229 crate/::Deserializerrust-analyzer cargo serde_core 1.0.229 de/Deserializer#<'de>,
234 {
235 use serderust-analyzer cargo serde 1.0.229 crate/::derust-analyzer cargo serde_core 1.0.229 de/::{Deserializerust-analyzer cargo serde_core 1.0.229 de/Deserialize#, Errorrust-analyzer cargo serde_core 1.0.229 de/Error#};
236 let error = || Errorrust-analyzer cargo serde_core 1.0.229 de/Error#::customrust-analyzer cargo serde_core 1.0.229 de/Error#custom().("invalid string");
237
238 let (i, b) = <&str>::deserializerust-analyzer cargo serde_core 1.0.229 de/impls/impl#[`&'a str`][`Deserialize<'de>`]deserialize().(deser)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
239 .split_oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split_once().(' ')
240 .ok_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or_else().(error)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/try_trait/Try#branch().;
241
242 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((
243 i.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().().map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| error())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/try_trait/Try#branch().,
244 b.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().().map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| error())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/try_trait/Try#branch().,
245 ))
246 }
247
248 pub(superrust-analyzer cargo schemars 1.2.2 enums_ref_variants/) fn json_schemarust-analyzer cargo schemars 1.2.2 enums_ref_variants/tuple_variant_as_str/json_schema().(_: &mut schemarsrust-analyzer cargo schemars 1.2.2 crate/::SchemaGeneratorrust-analyzer cargo schemars 1.2.2 generate/SchemaGenerator#) -> schemarsrust-analyzer cargo schemars 1.2.2 crate/::Schemarust-analyzer cargo schemars 1.2.2 schema/Schema# {
249 schemarsrust-analyzer cargo schemars 1.2.2 crate/::json_schemarust-analyzer cargo schemars 1.2.2 macros/json_schema!!({
250 "type": "string",
251 "pattern": r"^\d+ (true|false)$"
252 })
253 }
254 }
255
256 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
257 fn externally_tagged_enumrust-analyzer cargo schemars 1.2.2 enums_ref_variants/externally_tagged_enum().() {
258 testrust-analyzer cargo schemars 1.2.2 test!!(Externalrust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#)
259 .assert_snapshotrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_snapshot().()
260 .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().(Externalrust-analyzer cargo schemars 1.2.2 enums_ref_variants/External#::valuesrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[External]values().())
261 .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().());
262 }
263
264 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
265 fn internally_tagged_enumrust-analyzer cargo schemars 1.2.2 enums_ref_variants/internally_tagged_enum().() {
266 testrust-analyzer cargo schemars 1.2.2 test!!(Internalrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal#)
267 .assert_snapshotrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_snapshot().()
268 .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().(Internalrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Internal#::valuesrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Internal]values().())
269 .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().());
270 }
271
272 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
273 fn adjacently_tagged_enumrust-analyzer cargo schemars 1.2.2 enums_ref_variants/adjacently_tagged_enum().() {
274 testrust-analyzer cargo schemars 1.2.2 test!!(Adjacentrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#)
275 .assert_snapshotrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_snapshot().()
276 .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().(Adjacentrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Adjacent#::valuesrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Adjacent]values().())
277 .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().());
278 }
279
280 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
281 fn untagged_enumrust-analyzer cargo schemars 1.2.2 enums_ref_variants/untagged_enum().() {
282 testrust-analyzer cargo schemars 1.2.2 test!!(Untaggedrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#)
283 .assert_snapshotrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_snapshot().()
284 .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().(Untaggedrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Untagged#::valuesrust-analyzer cargo schemars 1.2.2 enums_ref_variants/impl#[Untagged]values().())
285 .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().());
286 }
287
288 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:, Serializerust-analyzer cargo serde_derive 1.0.229 Serialize:, Deserializerust-analyzer cargo serde_derive 1.0.229 Deserialize:)]
289 #[schemars(_unstable_ref_variants)]
290 enum NoVariantsrust-analyzer cargo schemars 1.2.2 enums_ref_variants/NoVariants# {}
291
292 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
293 fn no_variantsrust-analyzer cargo schemars 1.2.2 enums_ref_variants/no_variants().() {
294 testrust-analyzer cargo schemars 1.2.2 test!!(NoVariantsrust-analyzer cargo schemars 1.2.2 enums_ref_variants/NoVariants#)
295 .assert_snapshotrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_snapshot().()
296 .assert_rejects_derust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_rejects_de().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().());
297 }
298
299 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:, Serializerust-analyzer cargo serde_derive 1.0.229 Serialize:, Deserializerust-analyzer cargo serde_derive 1.0.229 Deserialize:)]
300 #[serde(rename_all_fields = "UPPERCASE", rename_all = "snake_case")]
301 #[schemars(_unstable_ref_variants)]
302 enum Renamedrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Renamed# {
303 StructVariantrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Renamed#StructVariant# {
304 fieldrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Renamed#StructVariant#field.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
305 },
306 #[serderust-analyzer cargo schemars_derive 1.2.2 serde:(rename = "custom name variant")]
307 RenamedStructVariantrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Renamed#RenamedStructVariant# {
308 #[serde(rename = "custom name field")]
309 fieldrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Renamed#RenamedStructVariant#field.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
310 },
311 }
312
313 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
314 fn renamedrust-analyzer cargo schemars 1.2.2 enums_ref_variants/renamed().() {
315 testrust-analyzer cargo schemars 1.2.2 test!!(Renamedrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Renamed#)
316 .assert_snapshotrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_snapshot().()
317 .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().([
318 Renamedrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Renamed#::StructVariantrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Renamed#StructVariant# {
319 fieldrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Renamed#StructVariant#field.: "foo".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(),
320 },
321 Renamedrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Renamed#::RenamedStructVariantrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Renamed#RenamedStructVariant# {
322 fieldrust-analyzer cargo schemars 1.2.2 enums_ref_variants/Renamed#RenamedStructVariant#field.: "bar".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(),
323 },
324 ])
325 .assert_rejects_derust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_rejects_de().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().());
326 }