jonasbb/serde_with ↗
Created Mar 21, 2023 · View the jonasbb/serde_with repository page
This crate provides custom de/serialization helpers to use in combination with serde's `with`-annotation and with the improved `serde_as`-annotation.
Want this for your repo?
Render a free sample of any GitHub repo in seconds.
Contributors
28
Lines of Code
2,042
From
Aug 17, 2017
To
Mar 17, 2023
About jonasbb/serde_with
serde_with is a Rust crate that extends the popular serde serialization framework with custom de/serialization helpers. It provides two main approaches: integration with serde's `with` annotation and an improved `serde_as` annotation that offers greater flexibility for handling complex type structures.
The crate handles numerous practical serialization challenges. It supports de/serializing types via their Display and FromStr traits, enables arrays larger than serde's standard 32-element limit including const-generic arrays, allows skipping empty Optional fields during serialization, and can deserialize comma-separated strings into vectors. It also provides utilities for adding prefixes or suffixes to struct field names and integrates with common Rust crates through optional feature flags.
A key advantage of serde_with over raw serde is the serde_as annotation's ability to mirror the structure of nested types, making it possible to specify converters for inner types of collections and other container types. The crate is well-documented with a user guide and supports both Apache 2.0 and MIT licensing, making it suitable for integration into diverse Rust projects.