This release contains significant breaking changes compared to v0.7.x.
Traits
-
The Serializer trait has been modified to allow for streaming serialization - serializing seq and map elements before knowing what the end of the seq or map will be. (#437)
-
Reduced boilerplate (no more SeqVisitor and MapVisitor) when implementing Serialize for most types.
// OLD API struct MySeqVisitor { /* ... */ } impl /* pages of boilerplate */ try!(serializer.serialize_seq(MySeqVisitor::new(iter, len))); // NEW API let mut state = try!(serializer.serialize_seq(len)); for e in iter { try!(serializer.serialize_seq_elt(&mut state, e)); } try!(serializer.serialize_seq_end(state));
-
The Serializer and Deserializer traits no longer provide default implementations for any methods. The old defaults were JSON-centric and inappropriate for most other formats. Every Serializer and Deserializer should mindfully implement all of the methods. (#437, #452)
Codegen
- No more public dependency on Syntex. The
serde_codegen::register
function which was deprecated in v0.7.9 has been removed. Users should useserde_codegen::expand
. See the readme for sample code, and see this forum topic for exposition. (#445) - Adjusted heuristic for generating bounds on generic type parameters (#456). This fixes a number of issues relating to bounds on recursive types, bounds involving references, and bounds involving private types (#435, #436, #441, #443)
Impls
- The Deserialize impl for
PhantomData<T>
has been expanded to allT
, not justT: Deserialize
(#457, #459) - Add Deserialize impl for
Box<str>
(#454)
Nightly
- The
nightly
feature has been renamed tounstable
to align with community practices. (#404)