johnstonskj / rust-email_address

A Rust crate providing an implementation of an RFC-compliant `EmailAddress` newtype.
MIT License
64 stars 12 forks source link

Serialize directly to string #27

Closed Anders429 closed 2 months ago

Anders429 commented 3 months ago

Fixes #26.

This simply provides a manual implementation of Serialize that correctly round-trips with the already-existing Deserialize implementation.

I also provided tests for both the failing round-trip (the test fails before the fix, and passes after), as well as a few other serde-related tests. With those tests I added dev-dependencies on both serde_assert (for testing the serde implementations) and claims (for making assertions with Result types much more ergonomic).

Note that this is a breaking change.