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]
name = "serde"
version = "0.7.6"
version = "0.7.7"
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
license = "MIT/Apache-2.0"
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>
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`.

View File

@ -122,11 +122,11 @@ pub trait Serializer {
/// Serializes a `f64` value.
fn serialize_f64(&mut self, v: f64) -> Result<(), Self::Error>;
/// Serializes a character. By default it serializes as bytes containing the UTF-8 encoding
/// of the character.
/// Serializes a character. By default it serializes it as a `&str` containing a
/// single character.
#[inline]
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`.

View File

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

View File

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

View File

@ -1,6 +1,6 @@
[package]
name = "serde_macros"
version = "0.7.6"
version = "0.7.7"
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
license = "MIT/Apache-2.0"
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]
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]
compiletest_rs = "^0.1.1"
rustc-serialize = "^0.3.16"
serde = { version = "^0.7.6", path = "../serde" }
serde = { version = "^0.7.7", path = "../serde" }
[[test]]
name = "test"