| 1 | #![allow(dead_code)] |
| 2 | |
| 3 | 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#, fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#}; |
| 4 | |
| 5 | use serderust-analyzer cargo serde 1.0.228 crate/::Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#; |
| 6 | |
| 7 | #[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:, Serializerust-analyzer cargo serde_derive 1.0.228 Serialize:)] |
| 8 | struct Configrust-analyzer cargo ron 0.12.0 Config# { |
| 9 | booleanrust-analyzer cargo ron 0.12.0 Config#boolean.: bool, |
| 10 | floatrust-analyzer cargo ron 0.12.0 Config#float.: f32, |
| 11 | maprust-analyzer cargo ron 0.12.0 Config#map.: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<u8, char>, |
| 12 | nestedrust-analyzer cargo ron 0.12.0 Config#nested.: Nestedrust-analyzer cargo ron 0.12.0 Nested#, |
| 13 | tuplerust-analyzer cargo ron 0.12.0 Config#tuple.: (u32, u32), |
| 14 | vecrust-analyzer cargo ron 0.12.0 Config#vec.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Nestedrust-analyzer cargo ron 0.12.0 Nested#>, |
| 15 | } |
| 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:, Serializerust-analyzer cargo serde_derive 1.0.228 Serialize:)] |
| 18 | struct Nestedrust-analyzer cargo ron 0.12.0 Nested# { |
| 19 | arust-analyzer cargo ron 0.12.0 Nested#a.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 20 | brust-analyzer cargo ron 0.12.0 Nested#b.: char, |
| 21 | } |
| 22 | |
| 23 | fn mainrust-analyzer cargo ron 0.12.0 main().() { |
| 24 | let config = Configrust-analyzer cargo ron 0.12.0 Config# { |
| 25 | booleanrust-analyzer cargo ron 0.12.0 Config#boolean.: true, |
| 26 | floatrust-analyzer cargo ron 0.12.0 Config#float.: 8.2, |
| 27 | maprust-analyzer cargo ron 0.12.0 Config#map.: [(1, '1'), (2, '4'), (3, '9'), (4, '1'), (5, '2'), (6, '3')] |
| 28 | .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().() |
| 29 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 30 | nestedrust-analyzer cargo ron 0.12.0 Config#nested.: Nestedrust-analyzer cargo ron 0.12.0 Nested# { |
| 31 | arust-analyzer cargo ron 0.12.0 Nested#a.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("Decode me!"), |
| 32 | brust-analyzer cargo ron 0.12.0 Nested#b.: 'z', |
| 33 | }, |
| 34 | tuplerust-analyzer cargo ron 0.12.0 Config#tuple.: (3, 7), |
| 35 | vecrust-analyzer cargo ron 0.12.0 Config#vec.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 36 | Nestedrust-analyzer cargo ron 0.12.0 Nested# { |
| 37 | arust-analyzer cargo ron 0.12.0 Nested#a.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("Nested 1"), |
| 38 | brust-analyzer cargo ron 0.12.0 Nested#b.: 'x', |
| 39 | }, |
| 40 | Nestedrust-analyzer cargo ron 0.12.0 Nested# { |
| 41 | arust-analyzer cargo ron 0.12.0 Nested#a.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("Nested 2"), |
| 42 | brust-analyzer cargo ron 0.12.0 Nested#b.: 'y', |
| 43 | }, |
| 44 | Nestedrust-analyzer cargo ron 0.12.0 Nested# { |
| 45 | arust-analyzer cargo ron 0.12.0 Nested#a.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("Nested 3"), |
| 46 | brust-analyzer cargo ron 0.12.0 Nested#b.: 'z', |
| 47 | }, |
| 48 | ], |
| 49 | }; |
| 50 | |
| 51 | let f = Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#::optionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[File]options().() |
| 52 | .createrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[OpenOptions]create().(true) |
| 53 | .writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[OpenOptions]write().(true) |
| 54 | .openrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[OpenOptions]open().("example-out.ron") |
| 55 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("Failed opening file"); |
| 56 | |
| 57 | ronrust-analyzer cargo ron 0.12.0 crate/::Optionsrust-analyzer cargo ron 0.12.0 options/Options#::defaultrust-analyzer cargo ron 0.12.0 options/impl#[Options][Default]default().() |
| 58 | .to_io_writer_prettyrust-analyzer cargo ron 0.12.0 options/impl#[Options]to_io_writer_pretty().(f, &config, 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().()) |
| 59 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("Failed to write to file"); |
| 60 | } |