Closed selfhoster1312 closed 1 year ago
Currently serde doesn't support asynchronous parsing (e.g. you can't make the from_reader
function async), so all purpose of the TryFromMultipart/TryFromChunks and so on is to make parsing asynchronous. Possibly there's another issue with that, so cc @murar8
Implementing the trait for external types directly is not possible AFAIK, we would need specialization to land on stable and it will be a long while if it ever does: https://github.com/rust-lang/rust/issues/31844
In the meanwhile your options are:
Currently serde doesn't support asynchronous parsing (e.g. you can't make the
from_reader
function async), so all purpose of the TryFromMultipart/TryFromChunks and so on is to make parsing asynchronous. Possibly there's another issue with that, so cc @murar8
Yeah I don't even know if it would be possible to hack in a blanket implementation for any item that is deserializable so that's definitely a no-go in my opinion.
Which types / external crates would you consider implementing the trait for?
I'd love if uuid and chrono would be supported
Sure I will look into it :+1:
Tracked in #46
I'm trying to parse a Multipart form into a struct that contains fields that are not defined in my crate, so i can't implement TryFromChunks for them. However they do implement FromStr, but implementing TryFromChunks for any types that implements FromStr would create implementation conflicts for most types...
These types also implement Deserialize. Maybe using serde::Deserialize instead of TryFromChunks could be an option (eg. behind a feature flag)?