Debian Codegraph @

tests/147_empty_sets_serialisation.rs

raw symbols SCIP
1 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/::HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#;
2
3 use serderust-analyzer cargo serde 1.0.228 crate/::{Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#, Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#};
4
5 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.228 Serialize:)]
6 struct UnitStructrust-analyzer cargo ron 0.12.0 UnitStruct#;
7
8 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.228 Serialize:)]
9 struct NewTyperust-analyzer cargo ron 0.12.0 NewType#(f32);
10
11 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.228 Serialize:)]
12 struct TupleStructrust-analyzer cargo ron 0.12.0 TupleStruct#(UnitStructrust-analyzer cargo ron 0.12.0 UnitStruct#, i8);
13
14 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.228 Serialize:)]
15 struct Keyrust-analyzer cargo ron 0.12.0 Key#(u32);
16
17 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.228 Serialize:)]
18 struct Structrust-analyzer cargo ron 0.12.0 Struct# {
19 tuplerust-analyzer cargo ron 0.12.0 Struct#tuple.: ((), NewTyperust-analyzer cargo ron 0.12.0 NewType#, TupleStructrust-analyzer cargo ron 0.12.0 TupleStruct#),
20 vecrust-analyzer cargo ron 0.12.0 Struct#vec.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<UnitStructrust-analyzer cargo ron 0.12.0 UnitStruct#>>,
21 maprust-analyzer cargo ron 0.12.0 Struct#map.: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<Keyrust-analyzer cargo ron 0.12.0 Key#, i32>,
22 deep_vecrust-analyzer cargo ron 0.12.0 Struct#deep_vec.: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<Keyrust-analyzer cargo ron 0.12.0 Key#, Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<()>>,
23 deep_maprust-analyzer cargo ron 0.12.0 Struct#deep_map.: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<Keyrust-analyzer cargo ron 0.12.0 Key#, HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<Keyrust-analyzer cargo ron 0.12.0 Key#, i32>>,
24 }
25
26 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
27 fn empty_sets_arraysrust-analyzer cargo ron 0.12.0 empty_sets_arrays().() {
28 let value = Structrust-analyzer cargo ron 0.12.0 Struct# {
29 tuplerust-analyzer cargo ron 0.12.0 Struct#tuple.: ((), NewTyperust-analyzer cargo ron 0.12.0 NewType#(0.5), TupleStructrust-analyzer cargo ron 0.12.0 TupleStruct#(UnitStructrust-analyzer cargo ron 0.12.0 UnitStruct#, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().5)),
30 vecrust-analyzer cargo ron 0.12.0 Struct#vec.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![],
31 maprust-analyzer cargo ron 0.12.0 Struct#map.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![].into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(),
32 deep_vecrust-analyzer cargo ron 0.12.0 Struct#deep_vec.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(Keyrust-analyzer cargo ron 0.12.0 Key#(0), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![])].into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(),
33 deep_maprust-analyzer cargo ron 0.12.0 Struct#deep_map.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(Keyrust-analyzer cargo ron 0.12.0 Key#(0), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![].into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().())]
34 .into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().()
35 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(),
36 };
37
38 let pretty = ronrust-analyzer cargo ron 0.12.0 crate/::serrust-analyzer cargo ron 0.12.0 ser/::PrettyConfigrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#::newrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]new().()
39 .enumerate_arraysrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]enumerate_arrays().(true)
40 .new_linerust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]new_line().("\n");
41 let serial = ronrust-analyzer cargo ron 0.12.0 crate/::serrust-analyzer cargo ron 0.12.0 ser/::to_string_prettyrust-analyzer cargo ron 0.12.0 ser/to_string_pretty().(&value, pretty).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
42
43 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("Serialized: {}", serial);
44
45 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
46 "(
47 tuple: ((), (0.5), ((), -5)),
48 vec: [],
49 map: {},
50 deep_vec: {
51 (0): [],
52 },
53 deep_map: {
54 (0): {},
55 },
56 )",
57 serial
58 );
59
60 let deserial = ronrust-analyzer cargo ron 0.12.0 crate/::derust-analyzer cargo ron 0.12.0 de/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().(&serial);
61
62 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(value), deserial);
63 }