]> git.lizzy.rs Git - rust.git/commit
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)
commit5e6d7871c656145a5530b653882a3ce26f40c163
treeb1e167790741751fe1823d39c5c36a3e08bafdf0
parent7393fde763484ec504399667c1808dc8c5a3559f
parent9df11ae83f8bfc06bc9bd1dc2132e344bc1ed0c7
auto merge of #4840 : jbclements/rust/add-json-enum-encoding, r=catamorphism

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.