serde-rs / serde

Serialization framework for Rust
https://serde.rs/
Apache License 2.0
8.81k stars 747 forks source link

Should `deserialize_any` be avoided in a library? #2726

Closed pitdicker closed 2 months ago

pitdicker commented 2 months ago

Asking this for https://github.com/chronotope/chrono/pull/926.

In chrono we have custom (de)serialization modules that serialize a DateTime to/from a i64 timestamp. There is a request for deserializing timestamps encoded as strings as well. Is using deserialize_any as in that PR the right choice? Or would that be a breaking change for users of formats that are not self-describing?

If it is not the right choice, can I ask for a quick opinion on implementing a host of modules for string timestamps (https://github.com/chronotope/chrono/pull/1067)?