| 1 | use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::{borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#, stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/::Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#}; |
| 2 | 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/; |
| 3 | |
| 4 | use serderust-analyzer cargo serde 1.0.228 crate/::{serrust-analyzer cargo serde_core 1.0.228 ser/, serrust-analyzer cargo serde_core 1.0.228 ser/::Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#}; |
| 5 | use serde_deriverust-analyzer cargo serde_derive 1.0.228 crate/::{Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.228 Serialize:}; |
| 6 | use unicode_identrust-analyzer cargo unicode-ident 1.0.0 crate/::is_xid_continuerust-analyzer cargo unicode-ident 1.0.0 is_xid_continue().; |
| 7 | |
| 8 | use craterust-analyzer cargo ron 0.12.0 crate/::{ |
| 9 | errorrust-analyzer cargo ron 0.12.0 error/::{Errorrust-analyzer cargo ron 0.12.0 error/Error#, Resultrust-analyzer cargo ron 0.12.0 error/Result#}, |
| 10 | extensionsrust-analyzer cargo ron 0.12.0 extensions/::Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions#, |
| 11 | optionsrust-analyzer cargo ron 0.12.0 options/::Optionsrust-analyzer cargo ron 0.12.0 options/Options#, |
| 12 | parserust-analyzer cargo ron 0.12.0 parse/::{is_ident_first_charrust-analyzer cargo ron 0.12.0 parse/is_ident_first_char()., is_ident_raw_charrust-analyzer cargo ron 0.12.0 parse/is_ident_raw_char()., is_whitespace_charrust-analyzer cargo ron 0.12.0 parse/is_whitespace_char()., LargeSIntrust-analyzer cargo ron 0.12.0 parse/LargeSInt#, LargeUIntrust-analyzer cargo ron 0.12.0 parse/LargeUInt#}, |
| 13 | }; |
| 14 | |
| 15 | pub mod path_metarust-analyzer cargo ron 0.12.0 ser/path_meta/; |
| 16 | |
| 17 | mod rawrust-analyzer cargo ron 0.12.0 ser/raw/; |
| 18 | #[cfg(test)] |
| 19 | mod testsrust-analyzer cargo ron 0.12.0 ser/tests/; |
| 20 | mod valuerust-analyzer cargo ron 0.12.0 ser/value/; |
| 21 | |
| 22 | /// Serializes `value` into `writer`. |
| 23 | /// |
| 24 | /// This function does not generate any newlines or nice formatting; |
| 25 | /// if you want that, you can use [`to_writer_pretty`] instead. |
| 26 | pub fn to_writerrust-analyzer cargo ron 0.12.0 ser/to_writer().<W, T>(writer: W, value: &T) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> |
| 27 | where |
| 28 | W: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#, |
| 29 | T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#, |
| 30 | { |
| 31 | Optionsrust-analyzer cargo ron 0.12.0 options/Options#::defaultrust-analyzer cargo ron 0.12.0 options/impl#[Options][Default]default().().to_writerrust-analyzer cargo ron 0.12.0 options/impl#[Options]to_writer().(writer, value) |
| 32 | } |
| 33 | |
| 34 | /// Serializes `value` into `writer` in a pretty way. |
| 35 | pub fn to_writer_prettyrust-analyzer cargo ron 0.12.0 ser/to_writer_pretty().<W, T>(writer: W, value: &T, config: PrettyConfigrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> |
| 36 | where |
| 37 | W: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#, |
| 38 | T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#, |
| 39 | { |
| 40 | Optionsrust-analyzer cargo ron 0.12.0 options/Options#::defaultrust-analyzer cargo ron 0.12.0 options/impl#[Options][Default]default().().to_writer_prettyrust-analyzer cargo ron 0.12.0 options/impl#[Options]to_writer_pretty().(writer, value, config) |
| 41 | } |
| 42 | |
| 43 | /// Serializes `value` and returns it as string. |
| 44 | /// |
| 45 | /// This function does not generate any newlines or nice formatting; |
| 46 | /// if you want that, you can use [`to_string_pretty`] instead. |
| 47 | pub fn to_stringrust-analyzer cargo ron 0.12.0 ser/to_string().<T>(value: &T) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> |
| 48 | where |
| 49 | T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#, |
| 50 | { |
| 51 | Optionsrust-analyzer cargo ron 0.12.0 options/Options#::defaultrust-analyzer cargo ron 0.12.0 options/impl#[Options][Default]default().().to_stringrust-analyzer cargo ron 0.12.0 options/impl#[Options]to_string().(value) |
| 52 | } |
| 53 | |
| 54 | /// Serializes `value` in the recommended RON layout in a pretty way. |
| 55 | pub fn to_string_prettyrust-analyzer cargo ron 0.12.0 ser/to_string_pretty().<T>(value: &T, config: PrettyConfigrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> |
| 56 | where |
| 57 | T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#, |
| 58 | { |
| 59 | Optionsrust-analyzer cargo ron 0.12.0 options/Options#::defaultrust-analyzer cargo ron 0.12.0 options/impl#[Options][Default]default().().to_string_prettyrust-analyzer cargo ron 0.12.0 options/impl#[Options]to_string_pretty().(value, config) |
| 60 | } |
| 61 | |
| 62 | /// Pretty serializer state |
| 63 | struct Prettyrust-analyzer cargo ron 0.12.0 ser/Pretty# { |
| 64 | indentrust-analyzer cargo ron 0.12.0 ser/Pretty#indent.: usize, |
| 65 | } |
| 66 | |
| 67 | /// Pretty serializer configuration. |
| 68 | /// |
| 69 | /// # Examples |
| 70 | /// |
| 71 | /// ``` |
| 72 | /// use ron::ser::PrettyConfig; |
| 73 | /// |
| 74 | /// let my_config = PrettyConfig::new() |
| 75 | /// .depth_limit(4) |
| 76 | /// // definitely superior (okay, just joking) |
| 77 | /// .indentor("\t"); |
| 78 | /// ``` |
| 79 | #[allow(clippy::struct_excessive_bools)] |
| 80 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, 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:, Serializerust-analyzer cargo serde_derive 1.0.228 Serialize:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:)] |
| 81 | #[serde(default)] |
| 82 | #[non_exhaustive] |
| 83 | pub struct PrettyConfigrust-analyzer cargo ron 0.12.0 ser/PrettyConfig# { |
| 84 | /// Limit the pretty-ness up to the given depth. |
| 85 | pub depth_limitrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#depth_limit.: usize, |
| 86 | /// New line string |
| 87 | pub new_linerust-analyzer cargo ron 0.12.0 ser/PrettyConfig#new_line.: Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str>, |
| 88 | /// Indentation string |
| 89 | pub indentorrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#indentor.: Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str>, |
| 90 | /// Separator string |
| 91 | pub separatorrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#separator.: Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str>, |
| 92 | // Whether to emit struct names |
| 93 | pub struct_namesrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#struct_names.: bool, |
| 94 | /// Separate tuple members with indentation |
| 95 | pub separate_tuple_membersrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#separate_tuple_members.: bool, |
| 96 | /// Enumerate array items in comments |
| 97 | pub enumerate_arraysrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#enumerate_arrays.: bool, |
| 98 | /// Enable extensions. Only configures `implicit_some`, |
| 99 | /// `unwrap_newtypes`, and `unwrap_variant_newtypes` for now. |
| 100 | pub extensionsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#extensions.: Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions#, |
| 101 | /// Enable compact arrays, which do not insert new lines and indentation |
| 102 | /// between the elements of an array |
| 103 | pub compact_arraysrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#compact_arrays.: bool, |
| 104 | /// Whether to serialize strings as escaped strings, |
| 105 | /// or fall back onto raw strings if necessary. |
| 106 | pub escape_stringsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#escape_strings.: bool, |
| 107 | /// Enable compact structs, which do not insert new lines and indentation |
| 108 | /// between the fields of a struct |
| 109 | pub compact_structsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#compact_structs.: bool, |
| 110 | /// Enable compact maps, which do not insert new lines and indentation |
| 111 | /// between the entries of a struct |
| 112 | pub compact_mapsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#compact_maps.: bool, |
| 113 | /// Enable explicit number type suffixes like `1u16` |
| 114 | pub number_suffixesrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#number_suffixes.: bool, |
| 115 | /// Additional path-based field metadata to serialize |
| 116 | pub path_metarust-analyzer cargo ron 0.12.0 ser/PrettyConfig#path_meta.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<path_metarust-analyzer cargo ron 0.12.0 ser/path_meta/::Fieldrust-analyzer cargo ron 0.12.0 ser/path_meta/Field#>, |
| 117 | } |
| 118 | |
| 119 | impl PrettyConfigrust-analyzer cargo ron 0.12.0 ser/PrettyConfig# { |
| 120 | /// Creates a default [`PrettyConfig`]. |
| 121 | #[must_use] |
| 122 | pub fn newrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]new().() -> Selfrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig] { |
| 123 | Selfrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]::defaultrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig][Default]default().() |
| 124 | } |
| 125 | |
| 126 | /// Limits the pretty-formatting based on the number of indentations. |
| 127 | /// I.e., with a depth limit of 5, starting with an element of depth |
| 128 | /// (indentation level) 6, everything will be put into the same line, |
| 129 | /// without pretty formatting. |
| 130 | /// |
| 131 | /// Default: [`usize::MAX`] |
| 132 | #[must_use] |
| 133 | pub fn depth_limitrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]depth_limit().(mut self, depth_limit: usize) -> Selfrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig] { |
| 134 | self.depth_limitrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#depth_limit. = depth_limit; |
| 135 | |
| 136 | self |
| 137 | } |
| 138 | |
| 139 | /// Configures the newlines used for serialization. |
| 140 | /// |
| 141 | /// Default: `\r\n` on Windows, `\n` otherwise |
| 142 | #[must_use] |
| 143 | pub fn new_linerust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]new_line().(mut self, new_line: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str>>) -> Selfrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig] { |
| 144 | self.new_linerust-analyzer cargo ron 0.12.0 ser/PrettyConfig#new_line. = new_line.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(); |
| 145 | |
| 146 | self |
| 147 | } |
| 148 | |
| 149 | /// Configures the string sequence used for indentation. |
| 150 | /// |
| 151 | /// Default: 4 spaces |
| 152 | #[must_use] |
| 153 | pub fn indentorrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]indentor().(mut self, indentor: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str>>) -> Selfrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig] { |
| 154 | self.indentorrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#indentor. = indentor.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(); |
| 155 | |
| 156 | self |
| 157 | } |
| 158 | |
| 159 | /// Configures the string sequence used to separate items inline. |
| 160 | /// |
| 161 | /// Default: 1 space |
| 162 | #[must_use] |
| 163 | pub fn separatorrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]separator().(mut self, separator: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str>>) -> Selfrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig] { |
| 164 | self.separatorrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#separator. = separator.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(); |
| 165 | |
| 166 | self |
| 167 | } |
| 168 | |
| 169 | /// Configures whether to emit struct names. |
| 170 | /// |
| 171 | /// See also [`Extensions::EXPLICIT_STRUCT_NAMES`] for the extension equivalent. |
| 172 | /// |
| 173 | /// Default: `false` |
| 174 | #[must_use] |
| 175 | pub fn struct_namesrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]struct_names().(mut self, struct_names: bool) -> Selfrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig] { |
| 176 | self.struct_namesrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#struct_names. = struct_names; |
| 177 | |
| 178 | self |
| 179 | } |
| 180 | |
| 181 | /// Configures whether tuples are single- or multi-line. |
| 182 | /// If set to `true`, tuples will have their fields indented and in new |
| 183 | /// lines. If set to `false`, tuples will be serialized without any |
| 184 | /// newlines or indentations. |
| 185 | /// |
| 186 | /// Default: `false` |
| 187 | #[must_use] |
| 188 | pub fn separate_tuple_membersrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]separate_tuple_members().(mut self, separate_tuple_members: bool) -> Selfrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig] { |
| 189 | self.separate_tuple_membersrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#separate_tuple_members. = separate_tuple_members; |
| 190 | |
| 191 | self |
| 192 | } |
| 193 | |
| 194 | /// Configures whether a comment shall be added to every array element, |
| 195 | /// indicating the index. |
| 196 | /// |
| 197 | /// Default: `false` |
| 198 | #[must_use] |
| 199 | pub fn enumerate_arraysrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]enumerate_arrays().(mut self, enumerate_arrays: bool) -> Selfrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig] { |
| 200 | self.enumerate_arraysrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#enumerate_arrays. = enumerate_arrays; |
| 201 | |
| 202 | self |
| 203 | } |
| 204 | |
| 205 | /// Configures whether every array should be a single line (`true`) |
| 206 | /// or a multi line one (`false`). |
| 207 | /// |
| 208 | /// When `false`, `["a","b"]` will serialize to |
| 209 | /// ``` |
| 210 | /// [ |
| 211 | /// "a", |
| 212 | /// "b", |
| 213 | /// ] |
| 214 | /// # ; |
| 215 | /// ``` |
| 216 | /// When `true`, `["a","b"]` will instead serialize to |
| 217 | /// ``` |
| 218 | /// ["a","b"] |
| 219 | /// # ; |
| 220 | /// ``` |
| 221 | /// |
| 222 | /// Default: `false` |
| 223 | #[must_use] |
| 224 | pub fn compact_arraysrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]compact_arrays().(mut self, compact_arrays: bool) -> Selfrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig] { |
| 225 | self.compact_arraysrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#compact_arrays. = compact_arrays; |
| 226 | |
| 227 | self |
| 228 | } |
| 229 | |
| 230 | /// Configures extensions |
| 231 | /// |
| 232 | /// Default: [`Extensions::empty()`] |
| 233 | #[must_use] |
| 234 | pub fn extensionsrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]extensions().(mut self, extensions: Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions#) -> Selfrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig] { |
| 235 | self.extensionsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#extensions. = extensions; |
| 236 | |
| 237 | self |
| 238 | } |
| 239 | |
| 240 | /// Configures whether strings should be serialized using escapes (true) |
| 241 | /// or fall back to raw strings if the string contains a `"` (false). |
| 242 | /// |
| 243 | /// When `true`, `"a\nb"` will serialize to |
| 244 | /// ``` |
| 245 | /// "a\nb" |
| 246 | /// # ; |
| 247 | /// ``` |
| 248 | /// When `false`, `"a\nb"` will instead serialize to |
| 249 | /// ``` |
| 250 | /// "a |
| 251 | /// b" |
| 252 | /// # ; |
| 253 | /// ``` |
| 254 | /// |
| 255 | /// Default: `true` |
| 256 | #[must_use] |
| 257 | pub fn escape_stringsrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]escape_strings().(mut self, escape_strings: bool) -> Selfrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig] { |
| 258 | self.escape_stringsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#escape_strings. = escape_strings; |
| 259 | |
| 260 | self |
| 261 | } |
| 262 | |
| 263 | /// Configures whether every struct should be a single line (`true`) |
| 264 | /// or a multi line one (`false`). |
| 265 | /// |
| 266 | /// When `false`, `Struct { a: 4, b: 2 }` will serialize to |
| 267 | /// ```ignore |
| 268 | /// Struct( |
| 269 | /// a: 4, |
| 270 | /// b: 2, |
| 271 | /// ) |
| 272 | /// # ; |
| 273 | /// ``` |
| 274 | /// When `true`, `Struct { a: 4, b: 2 }` will instead serialize to |
| 275 | /// ```ignore |
| 276 | /// Struct(a: 4, b: 2) |
| 277 | /// # ; |
| 278 | /// ``` |
| 279 | /// |
| 280 | /// Default: `false` |
| 281 | #[must_use] |
| 282 | pub fn compact_structsrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]compact_structs().(mut self, compact_structs: bool) -> Selfrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig] { |
| 283 | self.compact_structsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#compact_structs. = compact_structs; |
| 284 | |
| 285 | self |
| 286 | } |
| 287 | |
| 288 | /// Configures whether every map should be a single line (`true`) |
| 289 | /// or a multi line one (`false`). |
| 290 | /// |
| 291 | /// When `false`, a map with entries `{ "a": 4, "b": 2 }` will serialize to |
| 292 | /// ```ignore |
| 293 | /// { |
| 294 | /// "a": 4, |
| 295 | /// "b": 2, |
| 296 | /// } |
| 297 | /// # ; |
| 298 | /// ``` |
| 299 | /// When `true`, a map with entries `{ "a": 4, "b": 2 }` will instead |
| 300 | /// serialize to |
| 301 | /// ```ignore |
| 302 | /// {"a": 4, "b": 2} |
| 303 | /// # ; |
| 304 | /// ``` |
| 305 | /// |
| 306 | /// Default: `false` |
| 307 | #[must_use] |
| 308 | pub fn compact_mapsrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]compact_maps().(mut self, compact_maps: bool) -> Selfrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig] { |
| 309 | self.compact_mapsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#compact_maps. = compact_maps; |
| 310 | |
| 311 | self |
| 312 | } |
| 313 | |
| 314 | /// Configures whether numbers should be printed without (`false`) or |
| 315 | /// with (`true`) their explicit type suffixes. |
| 316 | /// |
| 317 | /// When `false`, the integer `12345u16` will serialize to |
| 318 | /// ```ignore |
| 319 | /// 12345 |
| 320 | /// # ; |
| 321 | /// ``` |
| 322 | /// and the float `12345.6789f64` will serialize to |
| 323 | /// ```ignore |
| 324 | /// 12345.6789 |
| 325 | /// # ; |
| 326 | /// ``` |
| 327 | /// When `true`, the integer `12345u16` will serialize to |
| 328 | /// ```ignore |
| 329 | /// 12345u16 |
| 330 | /// # ; |
| 331 | /// ``` |
| 332 | /// and the float `12345.6789f64` will serialize to |
| 333 | /// ```ignore |
| 334 | /// 12345.6789f64 |
| 335 | /// # ; |
| 336 | /// ``` |
| 337 | /// |
| 338 | /// Default: `false` |
| 339 | #[must_use] |
| 340 | pub fn number_suffixesrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]number_suffixes().(mut self, number_suffixes: bool) -> Selfrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig] { |
| 341 | self.number_suffixesrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#number_suffixes. = number_suffixes; |
| 342 | |
| 343 | self |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for PrettyConfigrust-analyzer cargo ron 0.12.0 ser/PrettyConfig# { |
| 348 | fn defaultrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig][Default]default().() -> Selfrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig][Default] { |
| 349 | PrettyConfigrust-analyzer cargo ron 0.12.0 ser/PrettyConfig# { |
| 350 | depth_limitrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#depth_limit.: usize::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]MAX., |
| 351 | new_linerust-analyzer cargo ron 0.12.0 ser/PrettyConfig#new_line.: if cfgrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/cfg!!(not(target_os = "windows")) { |
| 352 | Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#("\n") |
| 353 | } else { |
| 354 | Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#("\r\n") // GRCOV_EXCL_LINE |
| 355 | }, |
| 356 | indentorrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#indentor.: Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(" "), |
| 357 | separatorrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#separator.: Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(" "), |
| 358 | struct_namesrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#struct_names.: false, |
| 359 | separate_tuple_membersrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#separate_tuple_members.: false, |
| 360 | enumerate_arraysrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#enumerate_arrays.: false, |
| 361 | extensionsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#extensions.: Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions#::emptyrust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]empty().(), |
| 362 | compact_arraysrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#compact_arrays.: false, |
| 363 | escape_stringsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#escape_strings.: true, |
| 364 | compact_structsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#compact_structs.: false, |
| 365 | compact_mapsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#compact_maps.: false, |
| 366 | number_suffixesrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#number_suffixes.: false, |
| 367 | path_metarust-analyzer cargo ron 0.12.0 ser/PrettyConfig#path_meta.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 368 | } |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | /// The RON serializer. |
| 373 | /// |
| 374 | /// You can just use [`to_string`] for deserializing a value. |
| 375 | /// If you want it pretty-printed, take a look at [`to_string_pretty`]. |
| 376 | pub struct Serializerrust-analyzer cargo ron 0.12.0 ser/Serializer#<W: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#> { |
| 377 | outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output.: W, |
| 378 | prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(PrettyConfigrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#, Prettyrust-analyzer cargo ron 0.12.0 ser/Pretty#)>, |
| 379 | default_extensionsrust-analyzer cargo ron 0.12.0 ser/Serializer#default_extensions.: Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions#, |
| 380 | is_emptyrust-analyzer cargo ron 0.12.0 ser/Serializer#is_empty.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, |
| 381 | newtype_variantrust-analyzer cargo ron 0.12.0 ser/Serializer#newtype_variant.: bool, |
| 382 | recursion_limitrust-analyzer cargo ron 0.12.0 ser/Serializer#recursion_limit.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>, |
| 383 | // Tracks the number of opened implicit `Some`s, set to 0 on backtracking |
| 384 | implicit_some_depthrust-analyzer cargo ron 0.12.0 ser/Serializer#implicit_some_depth.: usize, |
| 385 | } |
| 386 | |
| 387 | fn indentrust-analyzer cargo ron 0.12.0 ser/indent().<W: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#>(output: &mut W, config: &PrettyConfigrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#, pretty: &Prettyrust-analyzer cargo ron 0.12.0 ser/Pretty#) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 388 | if pretty.indentrust-analyzer cargo ron 0.12.0 ser/Pretty#indent. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().config.depth_limitrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#depth_limit. { |
| 389 | for _ in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#pretty.indentrust-analyzer cargo ron 0.12.0 ser/Pretty#indent. { |
| 390 | output.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&config.indentorrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#indentor.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 391 | } |
| 392 | } |
| 393 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 394 | } |
| 395 | |
| 396 | impl<W: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#> Serializerrust-analyzer cargo ron 0.12.0 ser/Serializer#<W> { |
| 397 | /// Creates a new [`Serializer`]. |
| 398 | /// |
| 399 | /// Most of the time you can just use [`to_string`] or |
| 400 | /// [`to_string_pretty`]. |
| 401 | pub fn newrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]new().(writer: W, config: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PrettyConfigrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#>) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Selfrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]> { |
| 402 | Selfrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]::with_optionsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]with_options().(writer, config, &Optionsrust-analyzer cargo ron 0.12.0 options/Options#::defaultrust-analyzer cargo ron 0.12.0 options/impl#[Options][Default]default().()) |
| 403 | } |
| 404 | |
| 405 | /// Creates a new [`Serializer`]. |
| 406 | /// |
| 407 | /// Most of the time you can just use [`to_string`] or |
| 408 | /// [`to_string_pretty`]. |
| 409 | pub fn with_optionsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]with_options().( |
| 410 | mut writer: W, |
| 411 | config: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PrettyConfigrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#>, |
| 412 | options: &Optionsrust-analyzer cargo ron 0.12.0 options/Options#, |
| 413 | ) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Selfrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]> { |
| 414 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(conf) = &config { |
| 415 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().conf.new_linerust-analyzer cargo ron 0.12.0 ser/PrettyConfig#new_line..charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(is_whitespace_charrust-analyzer cargo ron 0.12.0 parse/is_whitespace_char().) { |
| 416 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::Messagerust-analyzer cargo ron 0.12.0 error/Error#Message#(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().( |
| 417 | "Invalid non-whitespace `PrettyConfig::new_line`", |
| 418 | ))); |
| 419 | } |
| 420 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().conf.indentorrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#indentor..charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(is_whitespace_charrust-analyzer cargo ron 0.12.0 parse/is_whitespace_char().) { |
| 421 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::Messagerust-analyzer cargo ron 0.12.0 error/Error#Message#(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().( |
| 422 | "Invalid non-whitespace `PrettyConfig::indentor`", |
| 423 | ))); |
| 424 | } |
| 425 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().conf.separatorrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#separator..charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(is_whitespace_charrust-analyzer cargo ron 0.12.0 parse/is_whitespace_char().) { |
| 426 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::Messagerust-analyzer cargo ron 0.12.0 error/Error#Message#(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().( |
| 427 | "Invalid non-whitespace `PrettyConfig::separator`", |
| 428 | ))); |
| 429 | } |
| 430 | |
| 431 | let non_default_extensions = !rust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions][Not]not().options.default_extensionsrust-analyzer cargo ron 0.12.0 options/Options#default_extensions.; |
| 432 | |
| 433 | for (extension_name, _) in (non_default_extensions rust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions][`BitAnd<Self>`]bitand().&rust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions][`BitAnd<Self>`]bitand(). rust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions][`BitAnd<Self>`]bitand().conf.extensionsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#extensions.).iter_namesrust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]iter_names().() { |
| 434 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(writer, "#![enable({})]", extension_name.to_lowercaserust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]to_lowercase().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 435 | writer.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&conf.new_linerust-analyzer cargo ron 0.12.0 ser/PrettyConfig#new_line.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 436 | } |
| 437 | }; |
| 438 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Serializerrust-analyzer cargo ron 0.12.0 ser/Serializer# { |
| 439 | outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output.: writer, |
| 440 | prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty.: config.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|conf| (conf, Prettyrust-analyzer cargo ron 0.12.0 ser/Pretty# { indentrust-analyzer cargo ron 0.12.0 ser/Pretty#indent.: 0 })), |
| 441 | default_extensionsrust-analyzer cargo ron 0.12.0 ser/Serializer#default_extensions.: options.default_extensionsrust-analyzer cargo ron 0.12.0 options/Options#default_extensions., |
| 442 | is_emptyrust-analyzer cargo ron 0.12.0 ser/Serializer#is_empty.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 443 | newtype_variantrust-analyzer cargo ron 0.12.0 ser/Serializer#newtype_variant.: false, |
| 444 | recursion_limitrust-analyzer cargo ron 0.12.0 ser/Serializer#recursion_limit.: options.recursion_limitrust-analyzer cargo ron 0.12.0 options/Options#recursion_limit., |
| 445 | implicit_some_depthrust-analyzer cargo ron 0.12.0 ser/Serializer#implicit_some_depth.: 0, |
| 446 | }) |
| 447 | } |
| 448 | |
| 449 | /// Unwrap the `Writer` from the `Serializer`. |
| 450 | #[inline] |
| 451 | pub fn into_innerrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]into_inner().(self) -> W { |
| 452 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output. |
| 453 | } |
| 454 | |
| 455 | fn separate_tuple_membersrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]separate_tuple_members().(&self) -> bool { |
| 456 | self.prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. |
| 457 | .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 458 | .map_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map_or().(false, |(ref config, _)| config.separate_tuple_membersrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#separate_tuple_members.) |
| 459 | } |
| 460 | |
| 461 | fn compact_arraysrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]compact_arrays().(&self) -> bool { |
| 462 | self.prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. |
| 463 | .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 464 | .map_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map_or().(false, |(ref config, _)| config.compact_arraysrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#compact_arrays.) |
| 465 | } |
| 466 | |
| 467 | fn compact_structsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]compact_structs().(&self) -> bool { |
| 468 | self.prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. |
| 469 | .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 470 | .map_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map_or().(false, |(ref config, _)| config.compact_structsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#compact_structs.) |
| 471 | } |
| 472 | |
| 473 | fn compact_mapsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]compact_maps().(&self) -> bool { |
| 474 | self.prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. |
| 475 | .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 476 | .map_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map_or().(false, |(ref config, _)| config.compact_mapsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#compact_maps.) |
| 477 | } |
| 478 | |
| 479 | fn number_suffixesrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]number_suffixes().(&self) -> bool { |
| 480 | self.prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. |
| 481 | .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 482 | .map_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map_or().(false, |(ref config, _)| config.number_suffixesrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#number_suffixes.) |
| 483 | } |
| 484 | |
| 485 | fn extensionsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]extensions().(&self) -> Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions# { |
| 486 | self.default_extensionsrust-analyzer cargo ron 0.12.0 ser/Serializer#default_extensions. |
| 487 | |rust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions][`BitOr<Self>`]bitor(). rust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions][`BitOr<Self>`]bitor().self |
| 488 | .prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. |
| 489 | .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 490 | .map_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map_or().(Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions#::emptyrust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]empty().(), |(ref config, _)| config.extensionsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#extensions.) |
| 491 | } |
| 492 | |
| 493 | fn escape_stringsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]escape_strings().(&self) -> bool { |
| 494 | self.prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. |
| 495 | .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 496 | .map_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map_or().(true, |(ref config, _)| config.escape_stringsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#escape_strings.) |
| 497 | } |
| 498 | |
| 499 | fn start_indentrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]start_indent().(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 500 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((ref config, ref mut pretty)) = self.prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. { |
| 501 | pretty.indentrust-analyzer cargo ron 0.12.0 ser/Pretty#indent. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 502 | if pretty.indentrust-analyzer cargo ron 0.12.0 ser/Pretty#indent. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().config.depth_limitrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#depth_limit. { |
| 503 | let is_empty = self.is_emptyrust-analyzer cargo ron 0.12.0 ser/Serializer#is_empty..unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(false); |
| 504 | |
| 505 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().is_empty { |
| 506 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&config.new_linerust-analyzer cargo ron 0.12.0 ser/PrettyConfig#new_line.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 507 | } |
| 508 | } |
| 509 | } |
| 510 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 511 | } |
| 512 | |
| 513 | fn indentrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]indent().(&mut self) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 514 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((ref config, ref pretty)) = self.prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. { |
| 515 | indentrust-analyzer cargo ron 0.12.0 ser/indent().(&mut self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output., config, pretty)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 516 | } |
| 517 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 518 | } |
| 519 | |
| 520 | fn end_indentrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]end_indent().(&mut self) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 521 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((ref config, ref mut pretty)) = self.prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. { |
| 522 | if pretty.indentrust-analyzer cargo ron 0.12.0 ser/Pretty#indent. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().config.depth_limitrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#depth_limit. { |
| 523 | let is_empty = self.is_emptyrust-analyzer cargo ron 0.12.0 ser/Serializer#is_empty..unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(false); |
| 524 | |
| 525 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().is_empty { |
| 526 | for _ in 1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#pretty.indentrust-analyzer cargo ron 0.12.0 ser/Pretty#indent. { |
| 527 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&config.indentorrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#indentor.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 528 | } |
| 529 | } |
| 530 | } |
| 531 | pretty.indentrust-analyzer cargo ron 0.12.0 ser/Pretty#indent. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`SubAssign<Self>`]sub_assign().1; |
| 532 | |
| 533 | self.is_emptyrust-analyzer cargo ron 0.12.0 ser/Serializer#is_empty. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 534 | } |
| 535 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 536 | } |
| 537 | |
| 538 | fn serialize_escaped_strrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_escaped_str().(&mut self, value: &str) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 539 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('"')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 540 | let mut scalar = [0u8; 4]; |
| 541 | for c in value.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().flat_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#flat_map().(char::escape_debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]escape_debug().) { |
| 542 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(c.encode_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]encode_utf8().(&mut scalar))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 543 | } |
| 544 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('"')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 545 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 546 | } |
| 547 | |
| 548 | fn serialize_unescaped_or_raw_strrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_unescaped_or_raw_str().(&mut self, value: &str) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 549 | if value.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().('"') || value.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().('\\') { |
| 550 | let (_, num_consecutive_hashes) = |
| 551 | value.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().foldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#fold().((0, 0), |(count, max), c| match c { |
| 552 | '#' => (count rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1, max.maxrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#max().(count rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1)), |
| 553 | _ => (0_usize, max), |
| 554 | }); |
| 555 | let hashes: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = "#".repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(num_consecutive_hashes rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1); |
| 556 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('r')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 557 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&hashes)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 558 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('"')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 559 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(value)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 560 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('"')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 561 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&hashes)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 562 | } else { |
| 563 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('"')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 564 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(value)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 565 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('"')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 566 | } |
| 567 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 568 | } |
| 569 | |
| 570 | fn serialize_escaped_byte_strrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_escaped_byte_str().(&mut self, value: &[u8]) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 571 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().("b\"")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 572 | for c in value.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().flat_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#flat_map().(|c| corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::asciirust-analyzer cargo core https://github.com/rust-lang/rust/library/core ascii/::escape_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ascii/escape_default().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().c)) { |
| 573 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().(char::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/convert/impl#[char][`From<u8>`]from().(c))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 574 | } |
| 575 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('"')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 576 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 577 | } |
| 578 | |
| 579 | fn serialize_unescaped_or_raw_byte_strrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_unescaped_or_raw_byte_str().(&mut self, value: &str) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 580 | if value.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().('"') || value.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().('\\') { |
| 581 | let (_, num_consecutive_hashes) = |
| 582 | value.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().foldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#fold().((0, 0), |(count, max), c| match c { |
| 583 | '#' => (count rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1, max.maxrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#max().(count rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1)), |
| 584 | _ => (0_usize, max), |
| 585 | }); |
| 586 | let hashes: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = "#".repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(num_consecutive_hashes rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1); |
| 587 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().("br")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 588 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&hashes)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 589 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('"')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 590 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(value)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 591 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('"')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 592 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&hashes)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 593 | } else { |
| 594 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().("b\"")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 595 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(value)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 596 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('"')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 597 | } |
| 598 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 599 | } |
| 600 | |
| 601 | fn serialize_sintrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_sint().(&mut self, value: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<LargeSIntrust-analyzer cargo ron 0.12.0 parse/LargeSInt#>, suffix: &str) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 602 | // TODO optimize |
| 603 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output., "{}", value.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 604 | |
| 605 | if self.number_suffixesrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]number_suffixes().() { |
| 606 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output., "{}", suffix)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 607 | } |
| 608 | |
| 609 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 610 | } |
| 611 | |
| 612 | fn serialize_uintrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_uint().(&mut self, value: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<LargeUIntrust-analyzer cargo ron 0.12.0 parse/LargeUInt#>, suffix: &str) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 613 | // TODO optimize |
| 614 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output., "{}", value.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 615 | |
| 616 | if self.number_suffixesrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]number_suffixes().() { |
| 617 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output., "{}", suffix)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 618 | } |
| 619 | |
| 620 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 621 | } |
| 622 | |
| 623 | fn write_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]write_identifier().(&mut self, name: &str) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 624 | self.validate_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]validate_identifier().(name)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 625 | let mut chars = name.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().(); |
| 626 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().chars.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Chars<'a>`][Iterator]next().().map_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map_or().(false, is_ident_first_charrust-analyzer cargo ron 0.12.0 parse/is_ident_first_char().) |
| 627 | || !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().chars.allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(is_xid_continuerust-analyzer cargo unicode-ident 1.0.0 is_xid_continue().) |
| 628 | || [ |
| 629 | "true", "false", "Some", "None", "inf", "inff32", "inff64", "NaN", "NaNf32", |
| 630 | "NaNf64", |
| 631 | ] |
| 632 | .containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&name) |
| 633 | { |
| 634 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().("r#")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 635 | } |
| 636 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(name)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 637 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 638 | } |
| 639 | |
| 640 | #[allow(clippy::unused_self)] |
| 641 | fn validate_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]validate_identifier().(&self, name: &str) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 642 | if name.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() || !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().name.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(is_ident_raw_charrust-analyzer cargo ron 0.12.0 parse/is_ident_raw_char().) { |
| 643 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::InvalidIdentifierrust-analyzer cargo ron 0.12.0 error/Error#InvalidIdentifier#(name.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())); |
| 644 | } |
| 645 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 646 | } |
| 647 | |
| 648 | /// Checks if struct names should be emitted |
| 649 | /// |
| 650 | /// Note that when using the `explicit_struct_names` extension, this method will use an OR operation on the extension and the [`PrettyConfig::struct_names`] option. See also [`Extensions::EXPLICIT_STRUCT_NAMES`] for the extension equivalent. |
| 651 | fn struct_namesrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]struct_names().(&self) -> bool { |
| 652 | self.extensionsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]extensions().() |
| 653 | .containsrust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]contains().(Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions#::EXPLICIT_STRUCT_NAMESrust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]EXPLICIT_STRUCT_NAMES.) |
| 654 | || self |
| 655 | .prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. |
| 656 | .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 657 | .map_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map_or().(false, |(pc, _)| pc.struct_namesrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#struct_names.) |
| 658 | } |
| 659 | } |
| 660 | |
| 661 | macro_rules! guard_recursionrust-analyzer cargo ron 0.12.0 ser/guard_recursion! { |
| 662 | ($self:expr => $expr:expr) => {{ |
| 663 | if let Some(limit) = &mut $self.recursion_limit { |
| 664 | if let Some(new_limit) = limit.checked_sub(1) { |
| 665 | *limit = new_limit; |
| 666 | } else { |
| 667 | return Err(Error::ExceededRecursionLimit); |
| 668 | } |
| 669 | } |
| 670 | |
| 671 | let result = $expr; |
| 672 | |
| 673 | if let Some(limit) = &mut $self.recursion_limit { |
| 674 | *limit = limit.saturating_add(1); |
| 675 | } |
| 676 | |
| 677 | result |
| 678 | }}; |
| 679 | } |
| 680 | |
| 681 | impl<'a, W: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#> serrust-analyzer cargo serde_core 1.0.228 ser/::Serializerrust-analyzer cargo serde_core 1.0.228 ser/Serializer# for &'a mut Serializerrust-analyzer cargo ron 0.12.0 ser/Serializer#<W> { |
| 682 | type Errorrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]Error# = Errorrust-analyzer cargo ron 0.12.0 error/Error#; |
| 683 | type Okrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]Ok# = (); |
| 684 | type SerializeMaprust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]SerializeMap# = Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#<'a, W>; |
| 685 | type SerializeSeqrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]SerializeSeq# = Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#<'a, W>; |
| 686 | type SerializeStructrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]SerializeStruct# = Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#<'a, W>; |
| 687 | type SerializeStructVariantrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]SerializeStructVariant# = Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#<'a, W>; |
| 688 | type SerializeTuplerust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]SerializeTuple# = Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#<'a, W>; |
| 689 | type SerializeTupleStructrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]SerializeTupleStruct# = Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#<'a, W>; |
| 690 | type SerializeTupleVariantrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]SerializeTupleVariant# = Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#<'a, W>; |
| 691 | |
| 692 | fn serialize_boolrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_bool().(self, v: bool) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 693 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(if v { "true" } else { "false" })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 694 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 695 | } |
| 696 | |
| 697 | fn serialize_i8rust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_i8().(self, v: i8) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 698 | self.serialize_sintrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_sint().(v, "i8") |
| 699 | } |
| 700 | |
| 701 | fn serialize_i16rust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_i16().(self, v: i16) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 702 | self.serialize_sintrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_sint().(v, "i16") |
| 703 | } |
| 704 | |
| 705 | fn serialize_i32rust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_i32().(self, v: i32) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 706 | self.serialize_sintrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_sint().(v, "i32") |
| 707 | } |
| 708 | |
| 709 | fn serialize_i64rust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_i64().(self, v: i64) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 710 | self.serialize_sintrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_sint().(v, "i64") |
| 711 | } |
| 712 | |
| 713 | #[cfg(feature = "integer128")] |
| 714 | fn serialize_i128rust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_i128().(self, v: i128) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 715 | self.serialize_sintrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_sint().(v, "i128") |
| 716 | } |
| 717 | |
| 718 | fn serialize_u8rust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_u8().(self, v: u8) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 719 | self.serialize_uintrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_uint().(v, "u8") |
| 720 | } |
| 721 | |
| 722 | fn serialize_u16rust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_u16().(self, v: u16) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 723 | self.serialize_uintrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_uint().(v, "u16") |
| 724 | } |
| 725 | |
| 726 | fn serialize_u32rust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_u32().(self, v: u32) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 727 | self.serialize_uintrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_uint().(v, "u32") |
| 728 | } |
| 729 | |
| 730 | fn serialize_u64rust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_u64().(self, v: u64) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 731 | self.serialize_uintrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_uint().(v, "u64") |
| 732 | } |
| 733 | |
| 734 | #[cfg(feature = "integer128")] |
| 735 | fn serialize_u128rust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_u128().(self, v: u128) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 736 | self.serialize_uintrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_uint().(v, "u128") |
| 737 | } |
| 738 | |
| 739 | fn serialize_f32rust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_f32().(self, v: f32) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 740 | if v.is_nanrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]is_nan().() && v.is_sign_negativerust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]is_sign_negative().() { |
| 741 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output., "-")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 742 | } |
| 743 | |
| 744 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output., "{}", v)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 745 | |
| 746 | // Equivalent to v.fract() == 0.0 |
| 747 | // See: https://docs.rs/num-traits/0.2.19/src/num_traits/float.rs.html#459-465 |
| 748 | if v rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Rem<Self>`]rem().1. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f32][`PartialEq<Self>`]eq().0.0 { |
| 749 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output., ".0")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 750 | } |
| 751 | |
| 752 | if self.number_suffixesrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]number_suffixes().() { |
| 753 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output., "f32")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 754 | } |
| 755 | |
| 756 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 757 | } |
| 758 | |
| 759 | fn serialize_f64rust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_f64().(self, v: f64) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 760 | if v.is_nanrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]is_nan().() && v.is_sign_negativerust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]is_sign_negative().() { |
| 761 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output., "-")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 762 | } |
| 763 | |
| 764 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output., "{}", v)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 765 | |
| 766 | // Equivalent to v.fract() == 0.0 |
| 767 | // See: https://docs.rs/num-traits/0.2.19/src/num_traits/float.rs.html#459-465 |
| 768 | if v rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Rem<Self>`]rem().1. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialEq<Self>`]eq().0.0 { |
| 769 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output., ".0")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 770 | } |
| 771 | |
| 772 | if self.number_suffixesrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]number_suffixes().() { |
| 773 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output., "f64")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 774 | } |
| 775 | |
| 776 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 777 | } |
| 778 | |
| 779 | fn serialize_charrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_char().(self, v: char) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 780 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('\'')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 781 | if v rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'\\' || v rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'\'' { |
| 782 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('\\')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 783 | } |
| 784 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output., "{}", v)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 785 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('\'')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 786 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 787 | } |
| 788 | |
| 789 | fn serialize_strrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_str().(self, v: &str) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 790 | if self.escape_stringsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]escape_strings().() { |
| 791 | self.serialize_escaped_strrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_escaped_str().(v)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 792 | } else { |
| 793 | self.serialize_unescaped_or_raw_strrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_unescaped_or_raw_str().(v)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 794 | } |
| 795 | |
| 796 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 797 | } |
| 798 | |
| 799 | fn serialize_bytesrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_bytes().(self, v: &[u8]) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 800 | // We need to fall back to escaping if the byte string would be invalid UTF-8 |
| 801 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.escape_stringsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]escape_strings().() { |
| 802 | if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(v) = corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(v) { |
| 803 | return self |
| 804 | .serialize_unescaped_or_raw_byte_strrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_unescaped_or_raw_byte_str().(v) |
| 805 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(Errorrust-analyzer cargo ron 0.12.0 error/Error#::fromrust-analyzer cargo ron 0.12.0 error/impl#[Error][`From<fmt::Error>`]from().); |
| 806 | } |
| 807 | } |
| 808 | |
| 809 | self.serialize_escaped_byte_strrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]serialize_escaped_byte_str().(v)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 810 | |
| 811 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 812 | } |
| 813 | |
| 814 | fn serialize_nonerust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_none().(self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 815 | // We no longer need to keep track of the depth |
| 816 | let implicit_some_depth = self.implicit_some_depthrust-analyzer cargo ron 0.12.0 ser/Serializer#implicit_some_depth.; |
| 817 | self.implicit_some_depthrust-analyzer cargo ron 0.12.0 ser/Serializer#implicit_some_depth. = 0; |
| 818 | |
| 819 | for _ in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#implicit_some_depth { |
| 820 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().("Some(")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 821 | } |
| 822 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().("None")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 823 | for _ in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#implicit_some_depth { |
| 824 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().(')')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 825 | } |
| 826 | |
| 827 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 828 | } |
| 829 | |
| 830 | fn serialize_somerust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_some().<T>(self, value: &T) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> |
| 831 | where |
| 832 | T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#, |
| 833 | { |
| 834 | let implicit_some = self.extensionsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]extensions().().containsrust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]contains().(Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions#::IMPLICIT_SOMErust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]IMPLICIT_SOME.); |
| 835 | if implicit_some { |
| 836 | self.implicit_some_depthrust-analyzer cargo ron 0.12.0 ser/Serializer#implicit_some_depth. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 837 | } else { |
| 838 | self.newtype_variantrust-analyzer cargo ron 0.12.0 ser/Serializer#newtype_variant. = self |
| 839 | .extensionsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]extensions().() |
| 840 | .containsrust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]contains().(Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions#::UNWRAP_VARIANT_NEWTYPESrust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]UNWRAP_VARIANT_NEWTYPES.); |
| 841 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().("Some(")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 842 | } |
| 843 | guard_recursionrust-analyzer cargo ron 0.12.0 ser/guard_recursion!! { self => value.serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#serialize().(&mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). }; |
| 844 | if implicit_some { |
| 845 | self.implicit_some_depthrust-analyzer cargo ron 0.12.0 ser/Serializer#implicit_some_depth. = 0; |
| 846 | } else { |
| 847 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().(')')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 848 | self.newtype_variantrust-analyzer cargo ron 0.12.0 ser/Serializer#newtype_variant. = false; |
| 849 | } |
| 850 | |
| 851 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 852 | } |
| 853 | |
| 854 | fn serialize_unitrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_unit().(self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 855 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.newtype_variantrust-analyzer cargo ron 0.12.0 ser/Serializer#newtype_variant. { |
| 856 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().("()")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 857 | } |
| 858 | |
| 859 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 860 | } |
| 861 | |
| 862 | fn serialize_unit_structrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_unit_struct().(self, name: &'static str) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 863 | if self.struct_namesrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]struct_names().() && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.newtype_variantrust-analyzer cargo ron 0.12.0 ser/Serializer#newtype_variant. { |
| 864 | self.write_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]write_identifier().(name)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 865 | |
| 866 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 867 | } else { |
| 868 | self.validate_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]validate_identifier().(name)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 869 | self.serialize_unitrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_unit().() |
| 870 | } |
| 871 | } |
| 872 | |
| 873 | fn serialize_unit_variantrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_unit_variant().( |
| 874 | self, |
| 875 | name: &'static str, |
| 876 | _variant_index: u32, |
| 877 | variant: &'static str, |
| 878 | ) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 879 | self.validate_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]validate_identifier().(name)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 880 | self.write_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]write_identifier().(variant)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 881 | |
| 882 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 883 | } |
| 884 | |
| 885 | fn serialize_newtype_structrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_newtype_struct().<T>(self, name: &'static str, value: &T) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> |
| 886 | where |
| 887 | T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#, |
| 888 | { |
| 889 | if name rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().craterust-analyzer cargo ron 0.12.0 crate/::valuerust-analyzer cargo ron 0.12.0 value/::rawrust-analyzer cargo ron 0.12.0 value/raw/::RAW_VALUE_TOKENrust-analyzer cargo ron 0.12.0 value/raw/RAW_VALUE_TOKEN. { |
| 890 | let implicit_some_depth = self.implicit_some_depthrust-analyzer cargo ron 0.12.0 ser/Serializer#implicit_some_depth.; |
| 891 | self.implicit_some_depthrust-analyzer cargo ron 0.12.0 ser/Serializer#implicit_some_depth. = 0; |
| 892 | |
| 893 | for _ in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#implicit_some_depth { |
| 894 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().("Some(")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 895 | } |
| 896 | |
| 897 | guard_recursionrust-analyzer cargo ron 0.12.0 ser/guard_recursion!! { self => value.serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#serialize().(rawrust-analyzer cargo ron 0.12.0 ser/raw/::Serializerrust-analyzer cargo ron 0.12.0 ser/raw/Serializer#::newrust-analyzer cargo ron 0.12.0 ser/raw/impl#[`Serializer<'a, W>`]new().(self)) }?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 898 | |
| 899 | for _ in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#implicit_some_depth { |
| 900 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().(')')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 901 | } |
| 902 | |
| 903 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()); |
| 904 | } |
| 905 | |
| 906 | if self.extensionsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]extensions().().containsrust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]contains().(Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions#::UNWRAP_NEWTYPESrust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]UNWRAP_NEWTYPES.) || self.newtype_variantrust-analyzer cargo ron 0.12.0 ser/Serializer#newtype_variant. { |
| 907 | self.newtype_variantrust-analyzer cargo ron 0.12.0 ser/Serializer#newtype_variant. = false; |
| 908 | |
| 909 | self.validate_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]validate_identifier().(name)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 910 | |
| 911 | return guard_recursionrust-analyzer cargo ron 0.12.0 ser/guard_recursion!! { self => value.serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#serialize().(&mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self) }; |
| 912 | } |
| 913 | |
| 914 | if self.struct_namesrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]struct_names().() { |
| 915 | self.write_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]write_identifier().(name)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 916 | } else { |
| 917 | self.validate_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]validate_identifier().(name)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 918 | } |
| 919 | |
| 920 | self.implicit_some_depthrust-analyzer cargo ron 0.12.0 ser/Serializer#implicit_some_depth. = 0; |
| 921 | |
| 922 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('(')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 923 | guard_recursionrust-analyzer cargo ron 0.12.0 ser/guard_recursion!! { self => value.serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#serialize().(&mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). }; |
| 924 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().(')')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 925 | |
| 926 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 927 | } |
| 928 | |
| 929 | fn serialize_newtype_variantrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_newtype_variant().<T>( |
| 930 | self, |
| 931 | name: &'static str, |
| 932 | _variant_index: u32, |
| 933 | variant: &'static str, |
| 934 | value: &T, |
| 935 | ) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> |
| 936 | where |
| 937 | T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#, |
| 938 | { |
| 939 | self.validate_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]validate_identifier().(name)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 940 | self.write_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]write_identifier().(variant)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 941 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('(')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 942 | |
| 943 | self.newtype_variantrust-analyzer cargo ron 0.12.0 ser/Serializer#newtype_variant. = self |
| 944 | .extensionsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]extensions().() |
| 945 | .containsrust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]contains().(Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions#::UNWRAP_VARIANT_NEWTYPESrust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]UNWRAP_VARIANT_NEWTYPES.); |
| 946 | self.implicit_some_depthrust-analyzer cargo ron 0.12.0 ser/Serializer#implicit_some_depth. = 0; |
| 947 | |
| 948 | guard_recursionrust-analyzer cargo ron 0.12.0 ser/guard_recursion!! { self => value.serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#serialize().(&mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). }; |
| 949 | |
| 950 | self.newtype_variantrust-analyzer cargo ron 0.12.0 ser/Serializer#newtype_variant. = false; |
| 951 | |
| 952 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().(')')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 953 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 954 | } |
| 955 | |
| 956 | fn serialize_seqrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_seq().(self, len: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Selfrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]::SerializeSeqrust-analyzer cargo serde_core 1.0.228 ser/Serializer#SerializeSeq#> { |
| 957 | self.newtype_variantrust-analyzer cargo ron 0.12.0 ser/Serializer#newtype_variant. = false; |
| 958 | self.implicit_some_depthrust-analyzer cargo ron 0.12.0 ser/Serializer#implicit_some_depth. = 0; |
| 959 | |
| 960 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('[')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 961 | |
| 962 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.compact_arraysrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]compact_arrays().() { |
| 963 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(len) = len { |
| 964 | self.is_emptyrust-analyzer cargo ron 0.12.0 ser/Serializer#is_empty. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0); |
| 965 | } |
| 966 | |
| 967 | self.start_indentrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]start_indent().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 968 | } |
| 969 | |
| 970 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#::newrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`]new().(self, false)) |
| 971 | } |
| 972 | |
| 973 | fn serialize_tuplerust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_tuple().(self, len: usize) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Selfrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]::SerializeTuplerust-analyzer cargo serde_core 1.0.228 ser/Serializer#SerializeTuple#> { |
| 974 | let old_newtype_variant = self.newtype_variantrust-analyzer cargo ron 0.12.0 ser/Serializer#newtype_variant.; |
| 975 | self.newtype_variantrust-analyzer cargo ron 0.12.0 ser/Serializer#newtype_variant. = false; |
| 976 | self.implicit_some_depthrust-analyzer cargo ron 0.12.0 ser/Serializer#implicit_some_depth. = 0; |
| 977 | |
| 978 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().old_newtype_variant { |
| 979 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('(')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 980 | } |
| 981 | |
| 982 | if self.separate_tuple_membersrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]separate_tuple_members().() { |
| 983 | self.is_emptyrust-analyzer cargo ron 0.12.0 ser/Serializer#is_empty. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0); |
| 984 | |
| 985 | self.start_indentrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]start_indent().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 986 | } |
| 987 | |
| 988 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#::newrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`]new().(self, old_newtype_variant)) |
| 989 | } |
| 990 | |
| 991 | fn serialize_tuple_structrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_tuple_struct().( |
| 992 | self, |
| 993 | name: &'static str, |
| 994 | len: usize, |
| 995 | ) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Selfrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]::SerializeTupleStructrust-analyzer cargo serde_core 1.0.228 ser/Serializer#SerializeTupleStruct#> { |
| 996 | if self.struct_namesrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]struct_names().() && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.newtype_variantrust-analyzer cargo ron 0.12.0 ser/Serializer#newtype_variant. { |
| 997 | self.write_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]write_identifier().(name)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 998 | } else { |
| 999 | self.validate_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]validate_identifier().(name)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1000 | } |
| 1001 | |
| 1002 | self.serialize_tuplerust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_tuple().(len) |
| 1003 | } |
| 1004 | |
| 1005 | fn serialize_tuple_variantrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_tuple_variant().( |
| 1006 | self, |
| 1007 | name: &'static str, |
| 1008 | _variant_index: u32, |
| 1009 | variant: &'static str, |
| 1010 | len: usize, |
| 1011 | ) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Selfrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]::SerializeTupleVariantrust-analyzer cargo serde_core 1.0.228 ser/Serializer#SerializeTupleVariant#> { |
| 1012 | self.newtype_variantrust-analyzer cargo ron 0.12.0 ser/Serializer#newtype_variant. = false; |
| 1013 | self.implicit_some_depthrust-analyzer cargo ron 0.12.0 ser/Serializer#implicit_some_depth. = 0; |
| 1014 | |
| 1015 | self.validate_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]validate_identifier().(name)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1016 | self.write_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]write_identifier().(variant)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1017 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('(')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1018 | |
| 1019 | if self.separate_tuple_membersrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]separate_tuple_members().() { |
| 1020 | self.is_emptyrust-analyzer cargo ron 0.12.0 ser/Serializer#is_empty. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0); |
| 1021 | |
| 1022 | self.start_indentrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]start_indent().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1023 | } |
| 1024 | |
| 1025 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#::newrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`]new().(self, false)) |
| 1026 | } |
| 1027 | |
| 1028 | fn serialize_maprust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_map().(self, len: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Selfrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]::SerializeMaprust-analyzer cargo serde_core 1.0.228 ser/Serializer#SerializeMap#> { |
| 1029 | self.newtype_variantrust-analyzer cargo ron 0.12.0 ser/Serializer#newtype_variant. = false; |
| 1030 | self.implicit_some_depthrust-analyzer cargo ron 0.12.0 ser/Serializer#implicit_some_depth. = 0; |
| 1031 | |
| 1032 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('{')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1033 | |
| 1034 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.compact_mapsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]compact_maps().() { |
| 1035 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(len) = len { |
| 1036 | self.is_emptyrust-analyzer cargo ron 0.12.0 ser/Serializer#is_empty. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0); |
| 1037 | } |
| 1038 | |
| 1039 | self.start_indentrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]start_indent().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1040 | } |
| 1041 | |
| 1042 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#::newrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`]new().(self, false)) |
| 1043 | } |
| 1044 | |
| 1045 | fn serialize_structrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_struct().(self, name: &'static str, len: usize) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Selfrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]::SerializeStructrust-analyzer cargo serde_core 1.0.228 ser/Serializer#SerializeStruct#> { |
| 1046 | let old_newtype_variant = self.newtype_variantrust-analyzer cargo ron 0.12.0 ser/Serializer#newtype_variant.; |
| 1047 | self.newtype_variantrust-analyzer cargo ron 0.12.0 ser/Serializer#newtype_variant. = false; |
| 1048 | self.implicit_some_depthrust-analyzer cargo ron 0.12.0 ser/Serializer#implicit_some_depth. = 0; |
| 1049 | |
| 1050 | if old_newtype_variant { |
| 1051 | self.validate_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]validate_identifier().(name)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1052 | } else { |
| 1053 | if self.struct_namesrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]struct_names().() { |
| 1054 | self.write_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]write_identifier().(name)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1055 | } else { |
| 1056 | self.validate_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]validate_identifier().(name)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1057 | } |
| 1058 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('(')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1059 | } |
| 1060 | |
| 1061 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.compact_structsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]compact_structs().() { |
| 1062 | self.is_emptyrust-analyzer cargo ron 0.12.0 ser/Serializer#is_empty. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0); |
| 1063 | self.start_indentrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]start_indent().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1064 | } |
| 1065 | |
| 1066 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#::newrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`]new().(self, old_newtype_variant)) |
| 1067 | } |
| 1068 | |
| 1069 | fn serialize_struct_variantrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]serialize_struct_variant().( |
| 1070 | self, |
| 1071 | name: &'static str, |
| 1072 | _variant_index: u32, |
| 1073 | variant: &'static str, |
| 1074 | len: usize, |
| 1075 | ) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Selfrust-analyzer cargo ron 0.12.0 ser/impl#[`&'a mut Serializer<W>`][Serializer]::SerializeStructVariantrust-analyzer cargo serde_core 1.0.228 ser/Serializer#SerializeStructVariant#> { |
| 1076 | self.newtype_variantrust-analyzer cargo ron 0.12.0 ser/Serializer#newtype_variant. = false; |
| 1077 | self.implicit_some_depthrust-analyzer cargo ron 0.12.0 ser/Serializer#implicit_some_depth. = 0; |
| 1078 | |
| 1079 | self.validate_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]validate_identifier().(name)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1080 | self.write_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]write_identifier().(variant)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1081 | self.outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('(')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1082 | |
| 1083 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.compact_structsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]compact_structs().() { |
| 1084 | self.is_emptyrust-analyzer cargo ron 0.12.0 ser/Serializer#is_empty. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0); |
| 1085 | self.start_indentrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]start_indent().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1086 | } |
| 1087 | |
| 1088 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#::newrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`]new().(self, false)) |
| 1089 | } |
| 1090 | } |
| 1091 | |
| 1092 | enum Staterust-analyzer cargo ron 0.12.0 ser/State# { |
| 1093 | Firstrust-analyzer cargo ron 0.12.0 ser/State#First#, |
| 1094 | Restrust-analyzer cargo ron 0.12.0 ser/State#Rest#, |
| 1095 | } |
| 1096 | |
| 1097 | #[doc(hidden)] |
| 1098 | pub struct Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#<'a, W: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#> { |
| 1099 | serrust-analyzer cargo ron 0.12.0 ser/Compound#ser.: &'a mut Serializerrust-analyzer cargo ron 0.12.0 ser/Serializer#<W>, |
| 1100 | staterust-analyzer cargo ron 0.12.0 ser/Compound#state.: Staterust-analyzer cargo ron 0.12.0 ser/State#, |
| 1101 | newtype_variantrust-analyzer cargo ron 0.12.0 ser/Compound#newtype_variant.: bool, |
| 1102 | sequence_indexrust-analyzer cargo ron 0.12.0 ser/Compound#sequence_index.: usize, |
| 1103 | } |
| 1104 | |
| 1105 | impl<'a, W: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#> Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#<'a, W> { |
| 1106 | fn newrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`]new().(ser: &'a mut Serializerrust-analyzer cargo ron 0.12.0 ser/Serializer#<W>, newtype_variant: bool) -> Selfrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`] { |
| 1107 | Compoundrust-analyzer cargo ron 0.12.0 ser/Compound# { |
| 1108 | serrust-analyzer cargo ron 0.12.0 ser/Compound#ser., |
| 1109 | staterust-analyzer cargo ron 0.12.0 ser/Compound#state.: Staterust-analyzer cargo ron 0.12.0 ser/State#::Firstrust-analyzer cargo ron 0.12.0 ser/State#First#, |
| 1110 | newtype_variantrust-analyzer cargo ron 0.12.0 ser/Compound#newtype_variant., |
| 1111 | sequence_indexrust-analyzer cargo ron 0.12.0 ser/Compound#sequence_index.: 0, |
| 1112 | } |
| 1113 | } |
| 1114 | } |
| 1115 | |
| 1116 | impl<'a, W: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#> Droprust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/drop/Drop# for Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#<'a, W> { |
| 1117 | fn droprust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][Drop]drop().(&mut self) { |
| 1118 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(limit) = &mut self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..recursion_limitrust-analyzer cargo ron 0.12.0 ser/Serializer#recursion_limit. { |
| 1119 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().limit = limit.saturating_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]saturating_add().(1); |
| 1120 | } |
| 1121 | } |
| 1122 | } |
| 1123 | |
| 1124 | impl<'a, W: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#> serrust-analyzer cargo serde_core 1.0.228 ser/::SerializeSeqrust-analyzer cargo serde_core 1.0.228 ser/SerializeSeq# for Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#<'a, W> { |
| 1125 | type Errorrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeSeq]Error# = Errorrust-analyzer cargo ron 0.12.0 error/Error#; |
| 1126 | type Okrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeSeq]Ok# = (); |
| 1127 | |
| 1128 | fn serialize_elementrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeSeq]serialize_element().<T>(&mut self, value: &T) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> |
| 1129 | where |
| 1130 | T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#, |
| 1131 | { |
| 1132 | if let Staterust-analyzer cargo ron 0.12.0 ser/State#::Firstrust-analyzer cargo ron 0.12.0 ser/State#First# = self.staterust-analyzer cargo ron 0.12.0 ser/Compound#state. { |
| 1133 | self.staterust-analyzer cargo ron 0.12.0 ser/Compound#state. = Staterust-analyzer cargo ron 0.12.0 ser/State#::Restrust-analyzer cargo ron 0.12.0 ser/State#Rest#; |
| 1134 | } else { |
| 1135 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().(',')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1136 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((ref config, ref mut pretty)) = self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. { |
| 1137 | if pretty.indentrust-analyzer cargo ron 0.12.0 ser/Pretty#indent. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().config.depth_limitrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#depth_limit. && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().config.compact_arraysrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#compact_arrays. { |
| 1138 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&config.new_linerust-analyzer cargo ron 0.12.0 ser/PrettyConfig#new_line.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1139 | } else { |
| 1140 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&config.separatorrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#separator.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1141 | } |
| 1142 | } |
| 1143 | } |
| 1144 | |
| 1145 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..compact_arraysrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]compact_arrays().() { |
| 1146 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..indentrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]indent().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1147 | } |
| 1148 | |
| 1149 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((ref mut config, ref mut pretty)) = self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. { |
| 1150 | if pretty.indentrust-analyzer cargo ron 0.12.0 ser/Pretty#indent. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().config.depth_limitrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#depth_limit. && config.enumerate_arraysrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#enumerate_arrays. { |
| 1151 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output., "/*[{}]*/ ", self.sequence_indexrust-analyzer cargo ron 0.12.0 ser/Compound#sequence_index.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1152 | self.sequence_indexrust-analyzer cargo ron 0.12.0 ser/Compound#sequence_index. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 1153 | } |
| 1154 | } |
| 1155 | |
| 1156 | guard_recursionrust-analyzer cargo ron 0.12.0 ser/guard_recursion!! { self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser. => value.serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#serialize().(&mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). }; |
| 1157 | |
| 1158 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 1159 | } |
| 1160 | |
| 1161 | fn endrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeSeq]end().(self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 1162 | if let Staterust-analyzer cargo ron 0.12.0 ser/State#::Restrust-analyzer cargo ron 0.12.0 ser/State#Rest# = self.staterust-analyzer cargo ron 0.12.0 ser/Compound#state. { |
| 1163 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((ref config, ref mut pretty)) = self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. { |
| 1164 | if pretty.indentrust-analyzer cargo ron 0.12.0 ser/Pretty#indent. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().config.depth_limitrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#depth_limit. && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().config.compact_arraysrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#compact_arrays. { |
| 1165 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().(',')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1166 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&config.new_linerust-analyzer cargo ron 0.12.0 ser/PrettyConfig#new_line.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1167 | } |
| 1168 | } |
| 1169 | } |
| 1170 | |
| 1171 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..compact_arraysrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]compact_arrays().() { |
| 1172 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..end_indentrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]end_indent().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1173 | } |
| 1174 | |
| 1175 | // seq always disables `self.newtype_variant` |
| 1176 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().(']')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1177 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 1178 | } |
| 1179 | } |
| 1180 | |
| 1181 | impl<'a, W: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#> serrust-analyzer cargo serde_core 1.0.228 ser/::SerializeTuplerust-analyzer cargo serde_core 1.0.228 ser/SerializeTuple# for Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#<'a, W> { |
| 1182 | type Errorrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeTuple]Error# = Errorrust-analyzer cargo ron 0.12.0 error/Error#; |
| 1183 | type Okrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeTuple]Ok# = (); |
| 1184 | |
| 1185 | fn serialize_elementrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeTuple]serialize_element().<T>(&mut self, value: &T) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> |
| 1186 | where |
| 1187 | T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#, |
| 1188 | { |
| 1189 | if let Staterust-analyzer cargo ron 0.12.0 ser/State#::Firstrust-analyzer cargo ron 0.12.0 ser/State#First# = self.staterust-analyzer cargo ron 0.12.0 ser/Compound#state. { |
| 1190 | self.staterust-analyzer cargo ron 0.12.0 ser/Compound#state. = Staterust-analyzer cargo ron 0.12.0 ser/State#::Restrust-analyzer cargo ron 0.12.0 ser/State#Rest#; |
| 1191 | } else { |
| 1192 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().(',')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1193 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((ref config, ref pretty)) = self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. { |
| 1194 | if pretty.indentrust-analyzer cargo ron 0.12.0 ser/Pretty#indent. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().config.depth_limitrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#depth_limit. && self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..separate_tuple_membersrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]separate_tuple_members().() { |
| 1195 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&config.new_linerust-analyzer cargo ron 0.12.0 ser/PrettyConfig#new_line.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1196 | } else { |
| 1197 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&config.separatorrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#separator.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1198 | } |
| 1199 | } |
| 1200 | } |
| 1201 | |
| 1202 | if self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..separate_tuple_membersrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]separate_tuple_members().() { |
| 1203 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..indentrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]indent().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1204 | } |
| 1205 | |
| 1206 | guard_recursionrust-analyzer cargo ron 0.12.0 ser/guard_recursion!! { self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser. => value.serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#serialize().(&mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). }; |
| 1207 | |
| 1208 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 1209 | } |
| 1210 | |
| 1211 | fn endrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeTuple]end().(self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 1212 | if let Staterust-analyzer cargo ron 0.12.0 ser/State#::Restrust-analyzer cargo ron 0.12.0 ser/State#Rest# = self.staterust-analyzer cargo ron 0.12.0 ser/Compound#state. { |
| 1213 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((ref config, ref pretty)) = self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. { |
| 1214 | if self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..separate_tuple_membersrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]separate_tuple_members().() && pretty.indentrust-analyzer cargo ron 0.12.0 ser/Pretty#indent. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().config.depth_limitrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#depth_limit. { |
| 1215 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().(',')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1216 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&config.new_linerust-analyzer cargo ron 0.12.0 ser/PrettyConfig#new_line.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1217 | } |
| 1218 | } |
| 1219 | } |
| 1220 | if self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..separate_tuple_membersrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]separate_tuple_members().() { |
| 1221 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..end_indentrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]end_indent().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1222 | } |
| 1223 | |
| 1224 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.newtype_variantrust-analyzer cargo ron 0.12.0 ser/Compound#newtype_variant. { |
| 1225 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().(')')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1226 | } |
| 1227 | |
| 1228 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 1229 | } |
| 1230 | } |
| 1231 | |
| 1232 | // Same thing but for tuple structs. |
| 1233 | impl<'a, W: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#> serrust-analyzer cargo serde_core 1.0.228 ser/::SerializeTupleStructrust-analyzer cargo serde_core 1.0.228 ser/SerializeTupleStruct# for Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#<'a, W> { |
| 1234 | type Errorrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeTupleStruct]Error# = Errorrust-analyzer cargo ron 0.12.0 error/Error#; |
| 1235 | type Okrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeTupleStruct]Ok# = (); |
| 1236 | |
| 1237 | fn serialize_fieldrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeTupleStruct]serialize_field().<T>(&mut self, value: &T) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> |
| 1238 | where |
| 1239 | T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#, |
| 1240 | { |
| 1241 | serrust-analyzer cargo serde_core 1.0.228 ser/::SerializeTuplerust-analyzer cargo serde_core 1.0.228 ser/SerializeTuple#::serialize_elementrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeTuple]serialize_element().(self, value) |
| 1242 | } |
| 1243 | |
| 1244 | fn endrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeTupleStruct]end().(self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 1245 | serrust-analyzer cargo serde_core 1.0.228 ser/::SerializeTuplerust-analyzer cargo serde_core 1.0.228 ser/SerializeTuple#::endrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeTuple]end().(self) |
| 1246 | } |
| 1247 | } |
| 1248 | |
| 1249 | impl<'a, W: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#> serrust-analyzer cargo serde_core 1.0.228 ser/::SerializeTupleVariantrust-analyzer cargo serde_core 1.0.228 ser/SerializeTupleVariant# for Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#<'a, W> { |
| 1250 | type Errorrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeTupleVariant]Error# = Errorrust-analyzer cargo ron 0.12.0 error/Error#; |
| 1251 | type Okrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeTupleVariant]Ok# = (); |
| 1252 | |
| 1253 | fn serialize_fieldrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeTupleVariant]serialize_field().<T>(&mut self, value: &T) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> |
| 1254 | where |
| 1255 | T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#, |
| 1256 | { |
| 1257 | serrust-analyzer cargo serde_core 1.0.228 ser/::SerializeTuplerust-analyzer cargo serde_core 1.0.228 ser/SerializeTuple#::serialize_elementrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeTuple]serialize_element().(self, value) |
| 1258 | } |
| 1259 | |
| 1260 | fn endrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeTupleVariant]end().(self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 1261 | serrust-analyzer cargo serde_core 1.0.228 ser/::SerializeTuplerust-analyzer cargo serde_core 1.0.228 ser/SerializeTuple#::endrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeTuple]end().(self) |
| 1262 | } |
| 1263 | } |
| 1264 | |
| 1265 | impl<'a, W: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#> serrust-analyzer cargo serde_core 1.0.228 ser/::SerializeMaprust-analyzer cargo serde_core 1.0.228 ser/SerializeMap# for Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#<'a, W> { |
| 1266 | type Errorrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeMap]Error# = Errorrust-analyzer cargo ron 0.12.0 error/Error#; |
| 1267 | type Okrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeMap]Ok# = (); |
| 1268 | |
| 1269 | fn serialize_keyrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeMap]serialize_key().<T>(&mut self, key: &T) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> |
| 1270 | where |
| 1271 | T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#, |
| 1272 | { |
| 1273 | if let Staterust-analyzer cargo ron 0.12.0 ser/State#::Firstrust-analyzer cargo ron 0.12.0 ser/State#First# = self.staterust-analyzer cargo ron 0.12.0 ser/Compound#state. { |
| 1274 | self.staterust-analyzer cargo ron 0.12.0 ser/Compound#state. = Staterust-analyzer cargo ron 0.12.0 ser/State#::Restrust-analyzer cargo ron 0.12.0 ser/State#Rest#; |
| 1275 | } else { |
| 1276 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().(',')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1277 | |
| 1278 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((ref config, ref pretty)) = self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. { |
| 1279 | if pretty.indentrust-analyzer cargo ron 0.12.0 ser/Pretty#indent. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().config.depth_limitrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#depth_limit. && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().config.compact_mapsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#compact_maps. { |
| 1280 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&config.new_linerust-analyzer cargo ron 0.12.0 ser/PrettyConfig#new_line.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1281 | } else { |
| 1282 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&config.separatorrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#separator.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1283 | } |
| 1284 | } |
| 1285 | } |
| 1286 | |
| 1287 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..compact_mapsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]compact_maps().() { |
| 1288 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..indentrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]indent().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1289 | } |
| 1290 | |
| 1291 | guard_recursionrust-analyzer cargo ron 0.12.0 ser/guard_recursion!! { self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser. => key.serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#serialize().(&mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser.) } |
| 1292 | } |
| 1293 | |
| 1294 | fn serialize_valuerust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeMap]serialize_value().<T>(&mut self, value: &T) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> |
| 1295 | where |
| 1296 | T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#, |
| 1297 | { |
| 1298 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().(':')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1299 | |
| 1300 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((ref config, _)) = self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. { |
| 1301 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&config.separatorrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#separator.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1302 | } |
| 1303 | |
| 1304 | guard_recursionrust-analyzer cargo ron 0.12.0 ser/guard_recursion!! { self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser. => value.serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#serialize().(&mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). }; |
| 1305 | |
| 1306 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 1307 | } |
| 1308 | |
| 1309 | fn endrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeMap]end().(self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 1310 | if let Staterust-analyzer cargo ron 0.12.0 ser/State#::Restrust-analyzer cargo ron 0.12.0 ser/State#Rest# = self.staterust-analyzer cargo ron 0.12.0 ser/Compound#state. { |
| 1311 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((ref config, ref pretty)) = self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. { |
| 1312 | if pretty.indentrust-analyzer cargo ron 0.12.0 ser/Pretty#indent. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().config.depth_limitrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#depth_limit. && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().config.compact_mapsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#compact_maps. { |
| 1313 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().(',')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1314 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&config.new_linerust-analyzer cargo ron 0.12.0 ser/PrettyConfig#new_line.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1315 | } |
| 1316 | } |
| 1317 | } |
| 1318 | |
| 1319 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..compact_mapsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]compact_maps().() { |
| 1320 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..end_indentrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]end_indent().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1321 | } |
| 1322 | |
| 1323 | // map always disables `self.newtype_variant` |
| 1324 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('}')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1325 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 1326 | } |
| 1327 | } |
| 1328 | |
| 1329 | impl<'a, W: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#> serrust-analyzer cargo serde_core 1.0.228 ser/::SerializeStructrust-analyzer cargo serde_core 1.0.228 ser/SerializeStruct# for Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#<'a, W> { |
| 1330 | type Errorrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeStruct]Error# = Errorrust-analyzer cargo ron 0.12.0 error/Error#; |
| 1331 | type Okrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeStruct]Ok# = (); |
| 1332 | |
| 1333 | fn serialize_fieldrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeStruct]serialize_field().<T>(&mut self, key: &'static str, value: &T) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> |
| 1334 | where |
| 1335 | T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#, |
| 1336 | { |
| 1337 | let mut restore_field = self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty..as_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_mut().().and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|(config, _)| { |
| 1338 | config.path_metarust-analyzer cargo ron 0.12.0 ser/PrettyConfig#path_meta..takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]take().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|mut field| { |
| 1339 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(fields) = field.fields_mutrust-analyzer cargo ron 0.12.0 ser/path_meta/impl#[Field]fields_mut().() { |
| 1340 | config.path_metarust-analyzer cargo ron 0.12.0 ser/PrettyConfig#path_meta. = fields.removerust-analyzer cargo ron 0.12.0 ser/path_meta/impl#[Fields]remove().(key); |
| 1341 | } |
| 1342 | field |
| 1343 | }) |
| 1344 | }); |
| 1345 | |
| 1346 | if let Staterust-analyzer cargo ron 0.12.0 ser/State#::Firstrust-analyzer cargo ron 0.12.0 ser/State#First# = self.staterust-analyzer cargo ron 0.12.0 ser/Compound#state. { |
| 1347 | self.staterust-analyzer cargo ron 0.12.0 ser/Compound#state. = Staterust-analyzer cargo ron 0.12.0 ser/State#::Restrust-analyzer cargo ron 0.12.0 ser/State#Rest#; |
| 1348 | } else { |
| 1349 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().(',')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1350 | |
| 1351 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((ref config, ref pretty)) = self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. { |
| 1352 | if pretty.indentrust-analyzer cargo ron 0.12.0 ser/Pretty#indent. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().config.depth_limitrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#depth_limit. && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().config.compact_structsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#compact_structs. { |
| 1353 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&config.new_linerust-analyzer cargo ron 0.12.0 ser/PrettyConfig#new_line.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1354 | } else { |
| 1355 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&config.separatorrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#separator.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1356 | } |
| 1357 | } |
| 1358 | } |
| 1359 | |
| 1360 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..compact_structsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]compact_structs().() { |
| 1361 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((ref config, ref pretty)) = self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. { |
| 1362 | indentrust-analyzer cargo ron 0.12.0 ser/indent().(&mut self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output., config, pretty)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1363 | |
| 1364 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref field) = config.path_metarust-analyzer cargo ron 0.12.0 ser/PrettyConfig#path_meta. { |
| 1365 | for doc_line in field.docrust-analyzer cargo ron 0.12.0 ser/path_meta/impl#[Field]doc().().linesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]lines().() { |
| 1366 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().("/// ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1367 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(doc_line)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1368 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().('\n')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1369 | indentrust-analyzer cargo ron 0.12.0 ser/indent().(&mut self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output., config, pretty)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1370 | } |
| 1371 | } |
| 1372 | } |
| 1373 | } |
| 1374 | |
| 1375 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..write_identifierrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]write_identifier().(key)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1376 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().(':')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1377 | |
| 1378 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((ref config, _)) = self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. { |
| 1379 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&config.separatorrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#separator.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1380 | } |
| 1381 | |
| 1382 | guard_recursionrust-analyzer cargo ron 0.12.0 ser/guard_recursion!! { self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser. => value.serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#serialize().(&mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). }; |
| 1383 | |
| 1384 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((ref mut config, _)) = self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. { |
| 1385 | corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::swaprust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/swap().(&mut config.path_metarust-analyzer cargo ron 0.12.0 ser/PrettyConfig#path_meta., &mut restore_field); |
| 1386 | |
| 1387 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref mut field) = config.path_metarust-analyzer cargo ron 0.12.0 ser/PrettyConfig#path_meta. { |
| 1388 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(fields) = field.fields_mutrust-analyzer cargo ron 0.12.0 ser/path_meta/impl#[Field]fields_mut().() { |
| 1389 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(restore_field) = restore_field { |
| 1390 | fields.insertrust-analyzer cargo ron 0.12.0 ser/path_meta/impl#[Fields]insert().(key, restore_field); |
| 1391 | } |
| 1392 | } |
| 1393 | } |
| 1394 | }; |
| 1395 | |
| 1396 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 1397 | } |
| 1398 | |
| 1399 | fn endrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeStruct]end().(self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 1400 | if let Staterust-analyzer cargo ron 0.12.0 ser/State#::Restrust-analyzer cargo ron 0.12.0 ser/State#Rest# = self.staterust-analyzer cargo ron 0.12.0 ser/Compound#state. { |
| 1401 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((ref config, ref pretty)) = self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..prettyrust-analyzer cargo ron 0.12.0 ser/Serializer#pretty. { |
| 1402 | if pretty.indentrust-analyzer cargo ron 0.12.0 ser/Pretty#indent. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().config.depth_limitrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#depth_limit. && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().config.compact_structsrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#compact_structs. { |
| 1403 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().(',')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1404 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_str().(&config.new_linerust-analyzer cargo ron 0.12.0 ser/PrettyConfig#new_line.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1405 | } |
| 1406 | } |
| 1407 | } |
| 1408 | |
| 1409 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..compact_structsrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]compact_structs().() { |
| 1410 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..end_indentrust-analyzer cargo ron 0.12.0 ser/impl#[`Serializer<W>`]end_indent().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1411 | } |
| 1412 | |
| 1413 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.newtype_variantrust-analyzer cargo ron 0.12.0 ser/Compound#newtype_variant. { |
| 1414 | self.serrust-analyzer cargo ron 0.12.0 ser/Compound#ser..outputrust-analyzer cargo ron 0.12.0 ser/Serializer#output..write_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#write_char().(')')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1415 | } |
| 1416 | |
| 1417 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 1418 | } |
| 1419 | } |
| 1420 | |
| 1421 | impl<'a, W: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Write#> serrust-analyzer cargo serde_core 1.0.228 ser/::SerializeStructVariantrust-analyzer cargo serde_core 1.0.228 ser/SerializeStructVariant# for Compoundrust-analyzer cargo ron 0.12.0 ser/Compound#<'a, W> { |
| 1422 | type Errorrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeStructVariant]Error# = Errorrust-analyzer cargo ron 0.12.0 error/Error#; |
| 1423 | type Okrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeStructVariant]Ok# = (); |
| 1424 | |
| 1425 | fn serialize_fieldrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeStructVariant]serialize_field().<T>(&mut self, key: &'static str, value: &T) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> |
| 1426 | where |
| 1427 | T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#, |
| 1428 | { |
| 1429 | serrust-analyzer cargo serde_core 1.0.228 ser/::SerializeStructrust-analyzer cargo serde_core 1.0.228 ser/SerializeStruct#::serialize_fieldrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeStruct]serialize_field().(self, key, value) |
| 1430 | } |
| 1431 | |
| 1432 | fn endrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeStructVariant]end().(self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> { |
| 1433 | serrust-analyzer cargo serde_core 1.0.228 ser/::SerializeStructrust-analyzer cargo serde_core 1.0.228 ser/SerializeStruct#::endrust-analyzer cargo ron 0.12.0 ser/impl#[`Compound<'a, W>`][SerializeStruct]end().(self) |
| 1434 | } |
| 1435 | } |