serde-rs / serde

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

Impl Serialize/Deserialize for std::num::Saturating<T> #2708

Closed jbethune closed 2 months ago

jbethune commented 4 months ago

It would be nice if we could get

use std::num::Saturating;

impl Deserialize for Saturating<T: Deserialize> { ... }
impl Serialize for Saturating<T: Serialize> { ... }

so that it is possible to handle wrapped types, that already support those traits.

jbethune commented 4 months ago

Edit: I mixed up Wrapping and Saturating. However, I still want to link to the implementations for Serialize and Deserialize for Wrapping<T>, because the future implementations for Saturating<T> will probably be very similar.