From 6717b4714b2852e3aee1530e661ab25107ea1f5e Mon Sep 17 00:00:00 2001 From: Eyal Kalderon Date: Sat, 22 Apr 2017 18:31:50 -0400 Subject: [PATCH] Update serialization to serde v1.0 --- CHANGELOG.md | 9 ++++++++- Cargo.toml | 8 ++++---- src/transform.rs | 36 ++++++++++++++++++------------------ 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cc37a0..42f81cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [v0.13.1] - 2017-04-22 + +### Changed + +- Update `serde` and `serde_derive` to version `1.0`. + ## [v0.13.0] - 2017-04-14 ### Added @@ -238,7 +244,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## v0.0.1 - 2014-06-24 -[Unreleased]: https://github.com/brendanzab/cgmath/compare/v0.13.0...HEAD +[Unreleased]: https://github.com/brendanzab/cgmath/compare/v0.13.1...HEAD +[v0.13.1]: https://github.com/brendanzab/cgmath/compare/v0.13.0...v0.13.1 [v0.12.0]: https://github.com/brendanzab/cgmath/compare/v0.12.0...v0.13.0 [v0.12.0]: https://github.com/brendanzab/cgmath/compare/v0.11.0...v0.12.0 [v0.11.0]: https://github.com/brendanzab/cgmath/compare/v0.10.0...v0.11.0 diff --git a/Cargo.toml b/Cargo.toml index a695354..fa6e8e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cgmath" -version = "0.13.0" +version = "0.13.1" authors = ["Brendan Zabarauskas ", "Brian Heylin", "Colin Sherratt", @@ -35,10 +35,10 @@ use_simd = ["simd"] approx = "0.1" num-traits = "0.1" rand = "0.3" -serde = { version = "0.9", optional = true } -serde_derive = { version = "0.9", optional = true } +serde = { version = "1.0", optional = true } +serde_derive = { version = "1.0", optional = true } simd = { version = "0.2", optional = true } [dev-dependencies] glium = "0.16" -serde_json = "0.9" +serde_json = "1.0" diff --git a/src/transform.rs b/src/transform.rs index e28a32e..442945d 100644 --- a/src/transform.rs +++ b/src/transform.rs @@ -224,13 +224,13 @@ mod eders_de { Disp, } - impl Deserialize for DecomposedField { + impl<'a> Deserialize<'a> for DecomposedField { fn deserialize(deserializer: D) -> Result - where D: serde::Deserializer + where D: serde::Deserializer<'a> { struct DecomposedFieldVisitor; - impl serde::de::Visitor for DecomposedFieldVisitor { + impl<'b> serde::de::Visitor<'b> for DecomposedFieldVisitor { type Value = DecomposedField; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { @@ -249,17 +249,17 @@ mod eders_de { } } - deserializer.deserialize(DecomposedFieldVisitor) + deserializer.deserialize_str(DecomposedFieldVisitor) } } - impl Deserialize for Decomposed - where S: Deserialize, - S::Scalar: Deserialize, - R: Deserialize + impl<'a, S: VectorSpace, R> Deserialize<'a> for Decomposed + where S: Deserialize<'a>, + S::Scalar: Deserialize<'a>, + R: Deserialize<'a> { fn deserialize(deserializer: D) -> Result, D::Error> - where D: serde::de::Deserializer + where D: serde::de::Deserializer<'a> { const FIELDS: &'static [&'static str] = &["scale", "rot", "disp"]; deserializer.deserialize_struct("Decomposed", FIELDS, DecomposedVisitor(PhantomData)) @@ -268,10 +268,10 @@ mod eders_de { struct DecomposedVisitor(PhantomData<(S, R)>); - impl serde::de::Visitor for DecomposedVisitor - where S: Deserialize, - S::Scalar: Deserialize, - R: Deserialize + impl<'a, S: VectorSpace, R> serde::de::Visitor<'a> for DecomposedVisitor + where S: Deserialize<'a>, + S::Scalar: Deserialize<'a>, + R: Deserialize<'a> { type Value = Decomposed; @@ -280,22 +280,22 @@ mod eders_de { } fn visit_map(self, mut visitor: V) -> Result, V::Error> - where V: serde::de::MapVisitor + where V: serde::de::MapAccess<'a> { let mut scale = None; let mut rot = None; let mut disp = None; - while let Some(key) = visitor.visit_key()? { + while let Some(key) = visitor.next_key()? { match key { DecomposedField::Scale => { - scale = Some(visitor.visit_value()?); + scale = Some(visitor.next_value()?); } DecomposedField::Rot => { - rot = Some(visitor.visit_value()?); + rot = Some(visitor.next_value()?); } DecomposedField::Disp => { - disp = Some(visitor.visit_value()?); + disp = Some(visitor.next_value()?); } } }