-
-
Notifications
You must be signed in to change notification settings - Fork 815
Consider changing Ipv*Addr serialization to a tuple of integers from a string #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The only issue I see is that some might prefer to output a |
I like the octet array version. Versus text: Once some version of #198 (mapping proxies) lands then serde can add pre-built text mapper proxies that folks can opt in to with annotations. Versus u32: Octet arrays look better in JSON. Also, arrays have the same endianness universally. The type I'm really interested in is |
@JohnHeitmann / @oli-obk: Now that 0.7 has the ability to customize the output, in #242 I decided it'd be easier to just serialize addresses to a string, and leave a more optimized form up to the user. |
We should leave this issue open to make sure we re-evaluate this decision after we see some usage of serde with these types. |
@oli-obk: Sure. I've changed the title, and bumped the milestone to v0.8. |
Any updates here? Have people mostly been happy with the string format? If so, we can close this. |
If anyone requests this in the future, we could provide a crate of alternative de/serialization representations so that you could do something like: #[serde(serialize_with="serde_alt::ipv6_to_tuple",
deserialize_with="serde_alt::ipv6_from_tuple")]
ip: Ipv6Addr |
Serde is missing support for
Ipv4Addr
andIpv6Addr
. It would be nice if we supported it and otherstd::net
types. One open question though is how should we actually serialize IP addresses? It would be the most compact by serializing to au32
or(u64, u64)
, or in pieces with(u8, u8, u8, u8)
and 8u16
s, but I'm sure human consumable formats like markdown or JSON would prefer a textual format.The text was updated successfully, but these errors were encountered: