greyblake / whatlang-rs

Natural language detection library for Rust. Try demo online: https://whatlang.org/
https://whatlang.org/
MIT License
965 stars 108 forks source link

`serde` support #134

Closed aumetra closed 1 year ago

aumetra commented 1 year ago

Would simple serde support be in scope?
Something like a simple #[derive(Deserialize, Serialize)] on Lang?

Rationale: I have structs containing a Lang and I would like to cache them in Redis which requires de-/serializing the structure.

Or should I just roll my own serialize_with and deserialize_with functions that work via the ISO codes?


If so, I'd be happy to contribute a PR. We can also go for a custom serde implementation that works via the ISO codes, to keep some universally agreed upon format.

greyblake commented 1 year ago

Thanks for your request. I've added support for serde in https://github.com/greyblake/whatlang-rs/pull/135 I just published a new version 0.16.3 so you can use it.

Have a great day!