]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #4840 : jbclements/rust/add-json-enum-encoding, r=catamorphism
authorbors <bors@rust-lang.org>
Wed, 13 Feb 2013 21:18:38 +0000 (13:18 -0800)
committerbors <bors@rust-lang.org>
Wed, 13 Feb 2013 21:18:38 +0000 (13:18 -0800)
r?

I added code to the JSON encoder to support the serialization of enums.  Before this, the JSON serializer only handled Option, and encoded None as 'null'. Following this change, all enums are encoded as arrays containing the enum name followed by the encoded fields. This appears consistent with the unstated invariant that the resulting output can be mapped back to the input *if* there's a decoder around that knows the types that were in existence when the serialization occurred.

Also, added test cases.


Trivial merge