jonasbb / serde_with

This crate provides custom de/serialization helpers to use in combination with serde's `with`-annotation and with the improved `serde_as`-annotation.
https://docs.rs/serde_with
Apache License 2.0
663 stars 72 forks source link

Bool from anything #710

Open estk opened 8 months ago

estk commented 8 months ago

I've been trying to migrate from serde_aux to this lib and having trouble finding the equivalent of serde_aux::deserialize_bool_from_anything.

I was wondering if I'm missing something or if equivalent functionality just doesnt exist here yet.

jonasbb commented 8 months ago

There is no direct equivalent for this. Most/all conversion types in this crate have a serialization function too. But it is possible to take the code from serde_aux and fill a DeserializeAs implementation with it. Although rewriting it to use a Visitor might help with error reporting.