undo the breaking change introduced in 0.7.6

This commit is contained in:
Oliver Schneider 2016-06-01 11:08:59 +02:00
parent e0bd57d63c
commit 96cd910c92
No known key found for this signature in database
GPG Key ID: 56D6EEA0FC67AC46
6 changed files with 12 additions and 12 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "serde" name = "serde"
version = "0.7.6" version = "0.7.7"
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"] authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
license = "MIT/Apache-2.0" license = "MIT/Apache-2.0"
description = "A generic serialization/deserialization framework" description = "A generic serialization/deserialization framework"

View File

@ -578,7 +578,7 @@ pub trait Visitor {
fn visit_char<E>(&mut self, v: char) -> Result<Self::Value, E> fn visit_char<E>(&mut self, v: char) -> Result<Self::Value, E>
where E: Error, where E: Error,
{ {
self.visit_str(::core::str::from_utf8(::utils::encode_utf8(v).as_slice()).unwrap()) self.visit_str(::utils::encode_utf8(v).as_str())
} }
/// `visit_str` deserializes a `&str` into a `Value`. /// `visit_str` deserializes a `&str` into a `Value`.

View File

@ -122,11 +122,11 @@ pub trait Serializer {
/// Serializes a `f64` value. /// Serializes a `f64` value.
fn serialize_f64(&mut self, v: f64) -> Result<(), Self::Error>; fn serialize_f64(&mut self, v: f64) -> Result<(), Self::Error>;
/// Serializes a character. By default it serializes as bytes containing the UTF-8 encoding /// Serializes a character. By default it serializes it as a `&str` containing a
/// of the character. /// single character.
#[inline] #[inline]
fn serialize_char(&mut self, v: char) -> Result<(), Self::Error> { fn serialize_char(&mut self, v: char) -> Result<(), Self::Error> {
self.serialize_bytes(::utils::encode_utf8(v).as_slice()) self.serialize_str(::utils::encode_utf8(v).as_str())
} }
/// Serializes a `&str`. /// Serializes a `&str`.

View File

@ -40,9 +40,9 @@ pub struct EncodeUtf8 {
} }
impl EncodeUtf8 { impl EncodeUtf8 {
/// Returns the remaining bytes of this iterator as a slice. // FIXME: use this from_utf8_unchecked, since we know it can never fail
pub fn as_slice(&self) -> &[u8] { pub fn as_str(&self) -> &str {
&self.buf[self.pos..] ::core::str::from_utf8(&self.buf[self.pos..]).unwrap()
} }
} }

View File

@ -1,6 +1,6 @@
[package] [package]
name = "serde_codegen" name = "serde_codegen"
version = "0.7.6" version = "0.7.7"
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"] authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
license = "MIT/Apache-2.0" license = "MIT/Apache-2.0"
description = "Macros to auto-generate implementations for the serde framework" description = "Macros to auto-generate implementations for the serde framework"

View File

@ -1,6 +1,6 @@
[package] [package]
name = "serde_macros" name = "serde_macros"
version = "0.7.6" version = "0.7.7"
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"] authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
license = "MIT/Apache-2.0" license = "MIT/Apache-2.0"
description = "Macros to auto-generate implementations for the serde framework" description = "Macros to auto-generate implementations for the serde framework"
@ -18,12 +18,12 @@ nightly-testing = ["clippy", "serde/nightly-testing", "serde_codegen/nightly-tes
[dependencies] [dependencies]
clippy = { version = "^0.*", optional = true } clippy = { version = "^0.*", optional = true }
serde_codegen = { version = "^0.7.6", path = "../serde_codegen", default-features = false, features = ["nightly"] } serde_codegen = { version = "^0.7.7", path = "../serde_codegen", default-features = false, features = ["nightly"] }
[dev-dependencies] [dev-dependencies]
compiletest_rs = "^0.1.1" compiletest_rs = "^0.1.1"
rustc-serialize = "^0.3.16" rustc-serialize = "^0.3.16"
serde = { version = "^0.7.6", path = "../serde" } serde = { version = "^0.7.7", path = "../serde" }
[[test]] [[test]]
name = "test" name = "test"