diff options
| author | Igor Tolmachev <me@igorek.dev> | 2024-07-17 17:38:19 +0900 |
|---|---|---|
| committer | Igor Tolmachev <me@igorek.dev> | 2024-07-17 17:38:19 +0900 |
| commit | 5f4ceda88c7299deb317f8d22a99ab2521c5a380 (patch) | |
| tree | 6b0d7e0ae99376079c599ee897fe73c2e5035420 /src/structs/ser.rs | |
| parent | 2f0f96ce4625d2ef1273c7bea98a1e9415419fdf (diff) | |
| download | archivator-5f4ceda88c7299deb317f8d22a99ab2521c5a380.tar.gz archivator-5f4ceda88c7299deb317f8d22a99ab2521c5a380.zip | |
Add more `#[inline]` markers
Diffstat (limited to 'src/structs/ser.rs')
| -rw-r--r-- | src/structs/ser.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/structs/ser.rs b/src/structs/ser.rs index 5c26182..f7e694a 100644 --- a/src/structs/ser.rs +++ b/src/structs/ser.rs | |||
| @@ -87,18 +87,22 @@ impl ser::Serializer for &mut ArchiveSerializer { | |||
| 87 | Ok(()) | 87 | Ok(()) |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | #[inline] | ||
| 90 | fn serialize_char(self, _v: char) -> StructResult<()> { | 91 | fn serialize_char(self, _v: char) -> StructResult<()> { |
| 91 | Err(StructError::SerializationNotSupported { type_name: "char" }.into()) | 92 | Err(StructError::SerializationNotSupported { type_name: "char" }.into()) |
| 92 | } | 93 | } |
| 93 | 94 | ||
| 95 | #[inline] | ||
| 94 | fn serialize_str(self, _v: &str) -> StructResult<()> { | 96 | fn serialize_str(self, _v: &str) -> StructResult<()> { |
| 95 | Err(StructError::SerializationNotSupported { type_name: "str" }.into()) | 97 | Err(StructError::SerializationNotSupported { type_name: "str" }.into()) |
| 96 | } | 98 | } |
| 97 | 99 | ||
| 100 | #[inline] | ||
| 98 | fn serialize_bytes(self, _v: &[u8]) -> StructResult<()> { | 101 | fn serialize_bytes(self, _v: &[u8]) -> StructResult<()> { |
| 99 | Err(StructError::SerializationNotSupported { type_name: "bytes" }.into()) | 102 | Err(StructError::SerializationNotSupported { type_name: "bytes" }.into()) |
| 100 | } | 103 | } |
| 101 | 104 | ||
| 105 | #[inline] | ||
| 102 | fn serialize_none(self) -> StructResult<()> { | 106 | fn serialize_none(self) -> StructResult<()> { |
| 103 | Err(StructError::SerializationNotSupported { | 107 | Err(StructError::SerializationNotSupported { |
| 104 | type_name: "optional", | 108 | type_name: "optional", |
| @@ -106,6 +110,7 @@ impl ser::Serializer for &mut ArchiveSerializer { | |||
| 106 | .into()) | 110 | .into()) |
| 107 | } | 111 | } |
| 108 | 112 | ||
| 113 | #[inline] | ||
| 109 | fn serialize_some<T>(self, _value: &T) -> StructResult<()> | 114 | fn serialize_some<T>(self, _value: &T) -> StructResult<()> |
| 110 | where | 115 | where |
| 111 | T: ?Sized + Serialize, | 116 | T: ?Sized + Serialize, |
| @@ -116,10 +121,12 @@ impl ser::Serializer for &mut ArchiveSerializer { | |||
| 116 | .into()) | 121 | .into()) |
| 117 | } | 122 | } |
| 118 | 123 | ||
| 124 | #[inline] | ||
| 119 | fn serialize_unit(self) -> StructResult<()> { | 125 | fn serialize_unit(self) -> StructResult<()> { |
| 120 | Ok(()) | 126 | Ok(()) |
| 121 | } | 127 | } |
| 122 | 128 | ||
| 129 | #[inline] | ||
| 123 | fn serialize_unit_struct(self, _name: &'static str) -> StructResult<()> { | 130 | fn serialize_unit_struct(self, _name: &'static str) -> StructResult<()> { |
| 124 | self.serialize_unit() | 131 | self.serialize_unit() |
| 125 | } | 132 | } |
| @@ -139,6 +146,7 @@ impl ser::Serializer for &mut ArchiveSerializer { | |||
| 139 | Ok(()) | 146 | Ok(()) |
| 140 | } | 147 | } |
| 141 | 148 | ||
| 149 | #[inline] | ||
| 142 | fn serialize_newtype_struct<T>(self, _name: &'static str, value: &T) -> StructResult<()> | 150 | fn serialize_newtype_struct<T>(self, _name: &'static str, value: &T) -> StructResult<()> |
| 143 | where | 151 | where |
| 144 | T: ?Sized + Serialize, | 152 | T: ?Sized + Serialize, |
| @@ -165,14 +173,17 @@ impl ser::Serializer for &mut ArchiveSerializer { | |||
| 165 | value.serialize(self) | 173 | value.serialize(self) |
| 166 | } | 174 | } |
| 167 | 175 | ||
| 176 | #[inline] | ||
| 168 | fn serialize_seq(self, _len: Option<usize>) -> StructResult<Self::SerializeSeq> { | 177 | fn serialize_seq(self, _len: Option<usize>) -> StructResult<Self::SerializeSeq> { |
| 169 | Err(StructError::SerializationNotSupported { type_name: "seq" }.into()) | 178 | Err(StructError::SerializationNotSupported { type_name: "seq" }.into()) |
| 170 | } | 179 | } |
| 171 | 180 | ||
| 181 | #[inline] | ||
| 172 | fn serialize_tuple(self, _len: usize) -> StructResult<Self::SerializeTuple> { | 182 | fn serialize_tuple(self, _len: usize) -> StructResult<Self::SerializeTuple> { |
| 173 | Ok(self) | 183 | Ok(self) |
| 174 | } | 184 | } |
| 175 | 185 | ||
| 186 | #[inline] | ||
| 176 | fn serialize_tuple_struct( | 187 | fn serialize_tuple_struct( |
| 177 | self, | 188 | self, |
| 178 | _name: &'static str, | 189 | _name: &'static str, |
| @@ -197,10 +208,12 @@ impl ser::Serializer for &mut ArchiveSerializer { | |||
| 197 | Ok(self) | 208 | Ok(self) |
| 198 | } | 209 | } |
| 199 | 210 | ||
| 211 | #[inline] | ||
| 200 | fn serialize_map(self, _len: Option<usize>) -> StructResult<Self::SerializeMap> { | 212 | fn serialize_map(self, _len: Option<usize>) -> StructResult<Self::SerializeMap> { |
| 201 | Err(StructError::SerializationNotSupported { type_name: "map" }.into()) | 213 | Err(StructError::SerializationNotSupported { type_name: "map" }.into()) |
| 202 | } | 214 | } |
| 203 | 215 | ||
| 216 | #[inline] | ||
| 204 | fn serialize_struct( | 217 | fn serialize_struct( |
| 205 | self, | 218 | self, |
| 206 | _name: &'static str, | 219 | _name: &'static str, |
| @@ -230,6 +243,7 @@ impl ser::SerializeSeq for &mut ArchiveSerializer { | |||
| 230 | type Ok = (); | 243 | type Ok = (); |
| 231 | type Error = ArchiveError<StructError>; | 244 | type Error = ArchiveError<StructError>; |
| 232 | 245 | ||
| 246 | #[inline] | ||
| 233 | fn serialize_element<T>(&mut self, _value: &T) -> StructResult<()> | 247 | fn serialize_element<T>(&mut self, _value: &T) -> StructResult<()> |
| 234 | where | 248 | where |
| 235 | T: ?Sized + Serialize, | 249 | T: ?Sized + Serialize, |
| @@ -237,6 +251,7 @@ impl ser::SerializeSeq for &mut ArchiveSerializer { | |||
| 237 | Err(StructError::SerializationNotSupported { type_name: "seq" }.into()) | 251 | Err(StructError::SerializationNotSupported { type_name: "seq" }.into()) |
| 238 | } | 252 | } |
| 239 | 253 | ||
| 254 | #[inline] | ||
| 240 | fn end(self) -> StructResult<()> { | 255 | fn end(self) -> StructResult<()> { |
| 241 | Err(StructError::SerializationNotSupported { type_name: "seq" }.into()) | 256 | Err(StructError::SerializationNotSupported { type_name: "seq" }.into()) |
| 242 | } | 257 | } |
| @@ -246,6 +261,7 @@ impl ser::SerializeTuple for &mut ArchiveSerializer { | |||
| 246 | type Ok = (); | 261 | type Ok = (); |
| 247 | type Error = ArchiveError<StructError>; | 262 | type Error = ArchiveError<StructError>; |
| 248 | 263 | ||
| 264 | #[inline] | ||
| 249 | fn serialize_element<T>(&mut self, value: &T) -> StructResult<()> | 265 | fn serialize_element<T>(&mut self, value: &T) -> StructResult<()> |
| 250 | where | 266 | where |
| 251 | T: ?Sized + Serialize, | 267 | T: ?Sized + Serialize, |
| @@ -253,6 +269,7 @@ impl ser::SerializeTuple for &mut ArchiveSerializer { | |||
| 253 | value.serialize(&mut **self) | 269 | value.serialize(&mut **self) |
| 254 | } | 270 | } |
| 255 | 271 | ||
| 272 | #[inline] | ||
| 256 | fn end(self) -> StructResult<()> { | 273 | fn end(self) -> StructResult<()> { |
| 257 | Ok(()) | 274 | Ok(()) |
| 258 | } | 275 | } |
| @@ -262,6 +279,7 @@ impl ser::SerializeTupleStruct for &mut ArchiveSerializer { | |||
| 262 | type Ok = (); | 279 | type Ok = (); |
| 263 | type Error = ArchiveError<StructError>; | 280 | type Error = ArchiveError<StructError>; |
| 264 | 281 | ||
| 282 | #[inline] | ||
| 265 | fn serialize_field<T>(&mut self, value: &T) -> StructResult<()> | 283 | fn serialize_field<T>(&mut self, value: &T) -> StructResult<()> |
| 266 | where | 284 | where |
| 267 | T: ?Sized + Serialize, | 285 | T: ?Sized + Serialize, |
| @@ -269,6 +287,7 @@ impl ser::SerializeTupleStruct for &mut ArchiveSerializer { | |||
| 269 | value.serialize(&mut **self) | 287 | value.serialize(&mut **self) |
| 270 | } | 288 | } |
| 271 | 289 | ||
| 290 | #[inline] | ||
| 272 | fn end(self) -> StructResult<()> { | 291 | fn end(self) -> StructResult<()> { |
| 273 | Ok(()) | 292 | Ok(()) |
| 274 | } | 293 | } |
| @@ -278,6 +297,7 @@ impl ser::SerializeTupleVariant for &mut ArchiveSerializer { | |||
| 278 | type Ok = (); | 297 | type Ok = (); |
| 279 | type Error = ArchiveError<StructError>; | 298 | type Error = ArchiveError<StructError>; |
| 280 | 299 | ||
| 300 | #[inline] | ||
| 281 | fn serialize_field<T>(&mut self, value: &T) -> StructResult<()> | 301 | fn serialize_field<T>(&mut self, value: &T) -> StructResult<()> |
| 282 | where | 302 | where |
| 283 | T: ?Sized + Serialize, | 303 | T: ?Sized + Serialize, |
| @@ -285,6 +305,7 @@ impl ser::SerializeTupleVariant for &mut ArchiveSerializer { | |||
| 285 | value.serialize(&mut **self) | 305 | value.serialize(&mut **self) |
| 286 | } | 306 | } |
| 287 | 307 | ||
| 308 | #[inline] | ||
| 288 | fn end(self) -> StructResult<()> { | 309 | fn end(self) -> StructResult<()> { |
| 289 | Ok(()) | 310 | Ok(()) |
| 290 | } | 311 | } |
| @@ -294,6 +315,7 @@ impl ser::SerializeMap for &mut ArchiveSerializer { | |||
| 294 | type Ok = (); | 315 | type Ok = (); |
| 295 | type Error = ArchiveError<StructError>; | 316 | type Error = ArchiveError<StructError>; |
| 296 | 317 | ||
| 318 | #[inline] | ||
| 297 | fn serialize_key<T>(&mut self, _key: &T) -> StructResult<()> | 319 | fn serialize_key<T>(&mut self, _key: &T) -> StructResult<()> |
| 298 | where | 320 | where |
| 299 | T: ?Sized + Serialize, | 321 | T: ?Sized + Serialize, |
| @@ -301,6 +323,7 @@ impl ser::SerializeMap for &mut ArchiveSerializer { | |||
| 301 | Err(StructError::SerializationNotSupported { type_name: "map" }.into()) | 323 | Err(StructError::SerializationNotSupported { type_name: "map" }.into()) |
| 302 | } | 324 | } |
| 303 | 325 | ||
| 326 | #[inline] | ||
| 304 | fn serialize_value<T>(&mut self, _value: &T) -> StructResult<()> | 327 | fn serialize_value<T>(&mut self, _value: &T) -> StructResult<()> |
| 305 | where | 328 | where |
| 306 | T: ?Sized + Serialize, | 329 | T: ?Sized + Serialize, |
| @@ -308,6 +331,7 @@ impl ser::SerializeMap for &mut ArchiveSerializer { | |||
| 308 | Err(StructError::SerializationNotSupported { type_name: "map" }.into()) | 331 | Err(StructError::SerializationNotSupported { type_name: "map" }.into()) |
| 309 | } | 332 | } |
| 310 | 333 | ||
| 334 | #[inline] | ||
| 311 | fn end(self) -> StructResult<()> { | 335 | fn end(self) -> StructResult<()> { |
| 312 | Err(StructError::SerializationNotSupported { type_name: "map" }.into()) | 336 | Err(StructError::SerializationNotSupported { type_name: "map" }.into()) |
| 313 | } | 337 | } |
| @@ -317,6 +341,7 @@ impl ser::SerializeStruct for &mut ArchiveSerializer { | |||
| 317 | type Ok = (); | 341 | type Ok = (); |
| 318 | type Error = ArchiveError<StructError>; | 342 | type Error = ArchiveError<StructError>; |
| 319 | 343 | ||
| 344 | #[inline] | ||
| 320 | fn serialize_field<T>(&mut self, _key: &'static str, value: &T) -> StructResult<()> | 345 | fn serialize_field<T>(&mut self, _key: &'static str, value: &T) -> StructResult<()> |
| 321 | where | 346 | where |
| 322 | T: ?Sized + Serialize, | 347 | T: ?Sized + Serialize, |
| @@ -324,6 +349,7 @@ impl ser::SerializeStruct for &mut ArchiveSerializer { | |||
| 324 | value.serialize(&mut **self) | 349 | value.serialize(&mut **self) |
| 325 | } | 350 | } |
| 326 | 351 | ||
| 352 | #[inline] | ||
| 327 | fn end(self) -> StructResult<()> { | 353 | fn end(self) -> StructResult<()> { |
| 328 | Ok(()) | 354 | Ok(()) |
| 329 | } | 355 | } |
| @@ -333,6 +359,7 @@ impl ser::SerializeStructVariant for &mut ArchiveSerializer { | |||
| 333 | type Ok = (); | 359 | type Ok = (); |
| 334 | type Error = ArchiveError<StructError>; | 360 | type Error = ArchiveError<StructError>; |
| 335 | 361 | ||
| 362 | #[inline] | ||
| 336 | fn serialize_field<T>(&mut self, _key: &'static str, value: &T) -> StructResult<()> | 363 | fn serialize_field<T>(&mut self, _key: &'static str, value: &T) -> StructResult<()> |
| 337 | where | 364 | where |
| 338 | T: ?Sized + Serialize, | 365 | T: ?Sized + Serialize, |
| @@ -340,6 +367,7 @@ impl ser::SerializeStructVariant for &mut ArchiveSerializer { | |||
| 340 | value.serialize(&mut **self) | 367 | value.serialize(&mut **self) |
| 341 | } | 368 | } |
| 342 | 369 | ||
| 370 | #[inline] | ||
| 343 | fn end(self) -> StructResult<()> { | 371 | fn end(self) -> StructResult<()> { |
| 344 | Ok(()) | 372 | Ok(()) |
| 345 | } | 373 | } |
