| 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:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 5 | struct Flatrust-analyzer cargo schemars 1.2.2 flatten/Flat# { |
| 6 | frust-analyzer cargo schemars 1.2.2 flatten/Flat#f.: f32, |
| 7 | brust-analyzer cargo schemars 1.2.2 flatten/Flat#b.: bool, |
| 8 | #[serderust-analyzer cargo schemars_derive 1.2.2 serde:(default, skip_serializing_if = "str::is_empty")] |
| 9 | srust-analyzer cargo schemars 1.2.2 flatten/Flat#s.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 10 | vrust-analyzer cargo schemars 1.2.2 flatten/Flat#v.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i32>, |
| 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:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 14 | #[schemars(rename = "Flat")] |
| 15 | struct Deep1rust-analyzer cargo schemars 1.2.2 flatten/Deep1# { |
| 16 | frust-analyzer cargo schemars 1.2.2 flatten/Deep1#f.: f32, |
| 17 | #[serderust-analyzer cargo schemars_derive 1.2.2 serde:(flatten)] |
| 18 | deep2rust-analyzer cargo schemars 1.2.2 flatten/Deep1#deep2.: Deep2rust-analyzer cargo schemars 1.2.2 flatten/Deep2#, |
| 19 | vrust-analyzer cargo schemars 1.2.2 flatten/Deep1#v.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i32>, |
| 20 | } |
| 21 | |
| 22 | #[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:)] |
| 23 | struct Deep2rust-analyzer cargo schemars 1.2.2 flatten/Deep2# { |
| 24 | brust-analyzer cargo schemars 1.2.2 flatten/Deep2#b.: bool, |
| 25 | #[serderust-analyzer cargo schemars_derive 1.2.2 serde:(flatten, skip_serializing_if = "Option::is_none")] |
| 26 | deep3rust-analyzer cargo schemars 1.2.2 flatten/Deep2#deep3.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Deep3rust-analyzer cargo schemars 1.2.2 flatten/Deep3#>, |
| 27 | } |
| 28 | |
| 29 | #[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:)] |
| 30 | struct Deep3rust-analyzer cargo schemars 1.2.2 flatten/Deep3# { |
| 31 | srust-analyzer cargo schemars 1.2.2 flatten/Deep3#s.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 32 | } |
| 33 | |
| 34 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 35 | fn flattened_structrust-analyzer cargo schemars 1.2.2 flatten/flattened_struct().() { |
| 36 | testrust-analyzer cargo schemars 1.2.2 test!!(Deep1rust-analyzer cargo schemars 1.2.2 flatten/Deep1#) |
| 37 | .assert_snapshotrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_snapshot().() |
| 38 | .assert_identicalrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_identical().::<Flatrust-analyzer cargo schemars 1.2.2 flatten/Flat#>() |
| 39 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().([ |
| 40 | Deep1rust-analyzer cargo schemars 1.2.2 flatten/Deep1#::defaultrust-analyzer cargo schemars 1.2.2 flatten/impl#[Deep1][Default]default().(), |
| 41 | Deep1rust-analyzer cargo schemars 1.2.2 flatten/Deep1# { |
| 42 | frust-analyzer cargo schemars 1.2.2 flatten/Deep1#f.: 1.0, |
| 43 | deep2rust-analyzer cargo schemars 1.2.2 flatten/Deep1#deep2.: Deep2rust-analyzer cargo schemars 1.2.2 flatten/Deep2# { |
| 44 | brust-analyzer cargo schemars 1.2.2 flatten/Deep2#b.: true, |
| 45 | deep3rust-analyzer cargo schemars 1.2.2 flatten/Deep2#deep3.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Deep3rust-analyzer cargo schemars 1.2.2 flatten/Deep3# { |
| 46 | srust-analyzer cargo schemars 1.2.2 flatten/Deep3#s.: "test".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), |
| 47 | }), |
| 48 | }, |
| 49 | vrust-analyzer cargo schemars 1.2.2 flatten/Deep1#v.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![123], |
| 50 | }, |
| 51 | ]) |
| 52 | .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().()); |
| 53 | } |
| 54 | |
| 55 | #[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:)] |
| 56 | struct FlattenValuerust-analyzer cargo schemars 1.2.2 flatten/FlattenValue# { |
| 57 | flagrust-analyzer cargo schemars 1.2.2 flatten/FlattenValue#flag.: bool, |
| 58 | #[serderust-analyzer cargo schemars_derive 1.2.2 serde:(flatten)] |
| 59 | valuerust-analyzer cargo schemars 1.2.2 flatten/FlattenValue#value.: Valuerust-analyzer cargo serde_json 1.0.151 value/Value#, |
| 60 | } |
| 61 | |
| 62 | #[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:)] |
| 63 | #[schemars(rename = "FlattenValue")] |
| 64 | struct FlattenMaprust-analyzer cargo schemars 1.2.2 flatten/FlattenMap# { |
| 65 | flagrust-analyzer cargo schemars 1.2.2 flatten/FlattenMap#flag.: bool, |
| 66 | #[serderust-analyzer cargo schemars_derive 1.2.2 serde:(flatten)] |
| 67 | valuerust-analyzer cargo schemars 1.2.2 flatten/FlattenMap#value.: 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#, Valuerust-analyzer cargo serde_json 1.0.151 value/Value#>, |
| 68 | } |
| 69 | |
| 70 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 71 | fn flattened_valuerust-analyzer cargo schemars 1.2.2 flatten/flattened_value().() { |
| 72 | testrust-analyzer cargo schemars 1.2.2 test!!(FlattenValuerust-analyzer cargo schemars 1.2.2 flatten/FlattenValue#) |
| 73 | .assert_snapshotrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_snapshot().() |
| 74 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().([ |
| 75 | FlattenValuerust-analyzer cargo schemars 1.2.2 flatten/FlattenValue# { |
| 76 | flagrust-analyzer cargo schemars 1.2.2 flatten/FlattenValue#flag.: false, |
| 77 | valuerust-analyzer cargo schemars 1.2.2 flatten/FlattenValue#value.: Valuerust-analyzer cargo serde_json 1.0.151 value/Value#::Nullrust-analyzer cargo serde_json 1.0.151 value/Value#Null#, |
| 78 | }, |
| 79 | FlattenValuerust-analyzer cargo schemars 1.2.2 flatten/FlattenValue# { |
| 80 | flagrust-analyzer cargo schemars 1.2.2 flatten/FlattenValue#flag.: true, |
| 81 | valuerust-analyzer cargo schemars 1.2.2 flatten/FlattenValue#value.: Valuerust-analyzer cargo serde_json 1.0.151 value/Value#::Objectrust-analyzer cargo serde_json 1.0.151 value/Value#Object#(Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo serde_json 1.0.151 map/impl#[`Map<String, Value>`][Default]default().()), |
| 82 | }, |
| 83 | ]) |
| 84 | .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().()); |
| 85 | } |
| 86 | |
| 87 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 88 | fn flattened_maprust-analyzer cargo schemars 1.2.2 flatten/flattened_map().() { |
| 89 | testrust-analyzer cargo schemars 1.2.2 test!!(FlattenMaprust-analyzer cargo schemars 1.2.2 flatten/FlattenMap#) |
| 90 | .assert_identicalrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_identical().::<FlattenValuerust-analyzer cargo schemars 1.2.2 flatten/FlattenValue#>() |
| 91 | .assert_allows_ser_roundtrip_defaultrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip_default().() |
| 92 | .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().()); |
| 93 | } |