diff --git a/serde/Cargo.toml b/serde/Cargo.toml index 221fd016..81b5dd60 100644 --- a/serde/Cargo.toml +++ b/serde/Cargo.toml @@ -1,6 +1,12 @@ [package] name = "serde" +<<<<<<< HEAD version = "0.9.13" # remember to update html_root_url +||||||| merged common ancestors +version = "0.9.13" +======= +version = "0.9.14" +>>>>>>> origin/master authors = ["Erick Tryzelaar "] license = "MIT/Apache-2.0" description = "A generic serialization/deserialization framework" diff --git a/serde/src/de/impls.rs b/serde/src/de/impls.rs index d7e6b7f8..4e8c7f0f 100644 --- a/serde/src/de/impls.rs +++ b/serde/src/de/impls.rs @@ -12,7 +12,82 @@ use de::{Deserialize, Deserializer, EnumAccess, Error, SeqAccess, Unexpected, Va Visitor}; #[cfg(any(feature = "std", feature = "collections"))] +<<<<<<< HEAD use de::MapAccess; +||||||| merged common ancestors +use core::cmp; +use core::fmt; +#[cfg(feature = "std")] +use core::hash::{Hash, BuildHasher}; +use core::marker::PhantomData; +#[cfg(feature = "std")] +use std::net; +#[cfg(feature = "std")] +use std::path; +use core::str; +#[cfg(feature = "std")] +use std::ffi::{CString, OsString}; +#[cfg(all(feature = "std", feature="unstable"))] +use std::ffi::CStr; + +#[cfg(feature = "std")] +use std::rc::Rc; +#[cfg(all(feature = "alloc", not(feature = "std")))] +use alloc::rc::Rc; + +#[cfg(feature = "std")] +use std::sync::Arc; +#[cfg(all(feature = "alloc", not(feature = "std")))] +use alloc::arc::Arc; + +#[cfg(all(feature = "alloc", not(feature = "std")))] +use alloc::boxed::Box; + +#[cfg(feature = "std")] +use std::time::Duration; + +#[cfg(feature = "std")] +use std; +======= +use core::cmp; +use core::fmt; +#[cfg(feature = "std")] +use core::hash::{Hash, BuildHasher}; +use core::marker::PhantomData; +#[cfg(feature = "std")] +use std::net; +#[cfg(feature = "std")] +use std::path; +use core::str; +#[cfg(feature = "std")] +use std::ffi::{CString, OsString}; +#[cfg(all(feature = "std", feature="unstable"))] +use std::ffi::CStr; + +#[cfg(feature = "std")] +use std::rc::Rc; +#[cfg(all(feature = "alloc", not(feature = "std")))] +use alloc::rc::Rc; + +#[cfg(feature = "std")] +use std::sync::Arc; +#[cfg(all(feature = "alloc", not(feature = "std")))] +use alloc::arc::Arc; + +#[cfg(all(feature = "alloc", not(feature = "std")))] +use alloc::boxed::Box; + +use core::cell::{Cell, RefCell}; + +#[cfg(feature = "std")] +use std::sync::{Mutex, RwLock}; + +#[cfg(feature = "std")] +use std::time::Duration; + +#[cfg(feature = "std")] +use std; +>>>>>>> origin/master use de::from_primitive::FromPrimitive; @@ -1135,7 +1210,51 @@ where } } +<<<<<<< HEAD //////////////////////////////////////////////////////////////////////////////// +||||||| merged common ancestors +/////////////////////////////////////////////////////////////////////////////// +======= +impl Deserialize for Cell { + fn deserialize(deserializer: D) -> Result, D::Error> + where D: Deserializer + { + let val = try!(Deserialize::deserialize(deserializer)); + Ok(Cell::new(val)) + } +} + +impl Deserialize for RefCell { + fn deserialize(deserializer: D) -> Result, D::Error> + where D: Deserializer + { + let val = try!(Deserialize::deserialize(deserializer)); + Ok(RefCell::new(val)) + } +} + +#[cfg(feature = "std")] +impl Deserialize for Mutex { + fn deserialize(deserializer: D) -> Result, D::Error> + where D: Deserializer + { + let val = try!(Deserialize::deserialize(deserializer)); + Ok(Mutex::new(val)) + } +} + +#[cfg(feature = "std")] +impl Deserialize for RwLock { + fn deserialize(deserializer: D) -> Result, D::Error> + where D: Deserializer + { + let val = try!(Deserialize::deserialize(deserializer)); + Ok(RwLock::new(val)) + } +} + +/////////////////////////////////////////////////////////////////////////////// +>>>>>>> origin/master // This is a cleaned-up version of the impl generated by: // diff --git a/serde/src/de/mod.rs b/serde/src/de/mod.rs index 3c9afa6f..dd5f09da 100644 --- a/serde/src/de/mod.rs +++ b/serde/src/de/mod.rs @@ -71,6 +71,10 @@ //! - Rc\ //! - Arc\ //! - Cow\<'a, T\> +//! - Cell\ +//! - RefCell\ +//! - Mutex\ +//! - RwLock\ //! - **Collection types**: //! - BTreeMap\ //! - BTreeSet\ diff --git a/serde/src/ser/impls.rs b/serde/src/ser/impls.rs index dad456f1..10415680 100644 --- a/serde/src/ser/impls.rs +++ b/serde/src/ser/impls.rs @@ -13,7 +13,18 @@ use ser::{Serialize, SerializeTuple, Serializer}; #[cfg(feature = "std")] use ser::Error; +<<<<<<< HEAD //////////////////////////////////////////////////////////////////////////////// +||||||| merged common ancestors +use core::marker::PhantomData; +======= +use core::cell::{Cell, RefCell}; + +#[cfg(feature = "std")] +use std::sync::{Mutex, RwLock}; + +use core::marker::PhantomData; +>>>>>>> origin/master macro_rules! primitive_impl { ($ty:ident, $method:ident $($cast:tt)*) => { @@ -349,7 +360,65 @@ deref_impl!(<'a, T: ?Sized> Serialize for Cow<'a, T> where T: Serialize + ToOwne #[cfg(feature = "unstable")] deref_impl!( Serialize for NonZero where T: Serialize + Zeroable); +<<<<<<< HEAD //////////////////////////////////////////////////////////////////////////////// +||||||| merged common ancestors +/////////////////////////////////////////////////////////////////////////////// +======= +impl Serialize for Cell + where T: Serialize + Copy +{ + #[inline] + fn serialize(&self, serializer: S) -> Result + where S: Serializer + { + self.get().serialize(serializer) + } +} + +impl Serialize for RefCell + where T: Serialize +{ + #[inline] + fn serialize(&self, serializer: S) -> Result + where S: Serializer + { + self.borrow().serialize(serializer) + } +} + +#[cfg(feature = "std")] +impl Serialize for Mutex + where T: Serialize +{ + #[inline] + fn serialize(&self, serializer: S) -> Result + where S: Serializer + { + match self.lock() { + Ok(locked) => locked.serialize(serializer), + Err(_) => Err(S::Error::custom("lock poison error while serializing")), + } + } +} + +#[cfg(feature = "std")] +impl Serialize for RwLock + where T: Serialize +{ + #[inline] + fn serialize(&self, serializer: S) -> Result + where S: Serializer + { + match self.read() { + Ok(locked) => locked.serialize(serializer), + Err(_) => Err(S::Error::custom("lock poison error while serializing")), + } + } +} + +/////////////////////////////////////////////////////////////////////////////// +>>>>>>> origin/master impl Serialize for Result where diff --git a/serde/src/ser/mod.rs b/serde/src/ser/mod.rs index 67b60fcc..565236ef 100644 --- a/serde/src/ser/mod.rs +++ b/serde/src/ser/mod.rs @@ -68,6 +68,10 @@ //! - Rc\ //! - Arc\ //! - Cow\<'a, T\> +//! - Cell\ +//! - RefCell\ +//! - Mutex\ +//! - RwLock\ //! - **Collection types**: //! - BTreeMap\ //! - BTreeSet\ diff --git a/serde_derive/Cargo.toml b/serde_derive/Cargo.toml index 9f8d99d2..086fbce8 100644 --- a/serde_derive/Cargo.toml +++ b/serde_derive/Cargo.toml @@ -1,6 +1,12 @@ [package] name = "serde_derive" +<<<<<<< HEAD version = "0.9.13" # remember to update html_root_url +||||||| merged common ancestors +version = "0.9.13" +======= +version = "0.9.14" +>>>>>>> origin/master authors = ["Erick Tryzelaar "] license = "MIT/Apache-2.0" description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]" diff --git a/serde_test/Cargo.toml b/serde_test/Cargo.toml index c7600ead..4feeca64 100644 --- a/serde_test/Cargo.toml +++ b/serde_test/Cargo.toml @@ -1,6 +1,12 @@ [package] name = "serde_test" +<<<<<<< HEAD version = "0.9.13" # remember to update html_root_url +||||||| merged common ancestors +version = "0.9.13" +======= +version = "0.9.14" +>>>>>>> origin/master authors = ["Erick Tryzelaar "] license = "MIT/Apache-2.0" description = "Token De/Serializer for testing De/Serialize implementations"