Fixed newtype serialization in multipart requests

This commit is contained in:
LasterAlex 2024-10-13 23:04:49 +03:00
parent b42d5b336b
commit 5434639cca
No known key found for this signature in database
2 changed files with 12 additions and 11 deletions

View file

@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Now Vec<MessageId> in requests serializes into [number] instead of [ {message_id: number} ], `forward_messages`, `copy_messages` and `delete_messages` now work properly - Now Vec<MessageId> in requests serializes into [number] instead of [ {message_id: number} ], `forward_messages`, `copy_messages` and `delete_messages` now work properly
- Now `ThreadId` is able to serialize in multipart requests
## 0.13.0 - 2024-08-16 ## 0.13.0 - 2024-08-16

View file

@ -374,6 +374,17 @@ impl Serializer for PartSerializer {
Ok(JsonPartSerializer { buf: String::new(), state: PartSerializerStructState::Empty }) Ok(JsonPartSerializer { buf: String::new(), state: PartSerializerStructState::Empty })
} }
fn serialize_newtype_struct<T: ?Sized>(
self,
_: &'static str,
value: &T,
) -> Result<Self::Ok, Self::Error>
where
T: Serialize,
{
value.serialize(self)
}
// Unimplemented // Unimplemented
fn serialize_none(self) -> Result<Self::Ok, Self::Error> { fn serialize_none(self) -> Result<Self::Ok, Self::Error> {
@ -391,17 +402,6 @@ impl Serializer for PartSerializer {
unimplemented!() unimplemented!()
} }
fn serialize_newtype_struct<T: ?Sized>(
self,
_: &'static str,
_: &T,
) -> Result<Self::Ok, Self::Error>
where
T: Serialize,
{
unimplemented!()
}
fn serialize_newtype_variant<T: ?Sized>( fn serialize_newtype_variant<T: ?Sized>(
self, self,
_name: &'static str, _name: &'static str,