Merge branch 'origin/master' into 'origin/1.0'
Conflicts: serde/Cargo.toml serde/src/de/impls.rs serde/src/ser/impls.rs serde_derive/Cargo.toml serde_test/Cargo.toml
This commit is contained in:
commit
a778425d0f
@ -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 <erick.tryzelaar@gmail.com>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
description = "A generic serialization/deserialization framework"
|
||||
|
@ -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<T: Deserialize + Copy> Deserialize for Cell<T> {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Cell<T>, D::Error>
|
||||
where D: Deserializer
|
||||
{
|
||||
let val = try!(Deserialize::deserialize(deserializer));
|
||||
Ok(Cell::new(val))
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Deserialize> Deserialize for RefCell<T> {
|
||||
fn deserialize<D>(deserializer: D) -> Result<RefCell<T>, D::Error>
|
||||
where D: Deserializer
|
||||
{
|
||||
let val = try!(Deserialize::deserialize(deserializer));
|
||||
Ok(RefCell::new(val))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<T: Deserialize> Deserialize for Mutex<T> {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Mutex<T>, D::Error>
|
||||
where D: Deserializer
|
||||
{
|
||||
let val = try!(Deserialize::deserialize(deserializer));
|
||||
Ok(Mutex::new(val))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<T: Deserialize> Deserialize for RwLock<T> {
|
||||
fn deserialize<D>(deserializer: D) -> Result<RwLock<T>, 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:
|
||||
//
|
||||
|
@ -71,6 +71,10 @@
|
||||
//! - Rc\<T\>
|
||||
//! - Arc\<T\>
|
||||
//! - Cow\<'a, T\>
|
||||
//! - Cell\<T\>
|
||||
//! - RefCell\<T\>
|
||||
//! - Mutex\<T\>
|
||||
//! - RwLock\<T\>
|
||||
//! - **Collection types**:
|
||||
//! - BTreeMap\<K, V\>
|
||||
//! - BTreeSet\<T\>
|
||||
|
@ -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!(<T> Serialize for NonZero<T> where T: Serialize + Zeroable);
|
||||
|
||||
<<<<<<< HEAD
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
||||||| merged common ancestors
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
=======
|
||||
impl<T> Serialize for Cell<T>
|
||||
where T: Serialize + Copy
|
||||
{
|
||||
#[inline]
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where S: Serializer
|
||||
{
|
||||
self.get().serialize(serializer)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Serialize for RefCell<T>
|
||||
where T: Serialize
|
||||
{
|
||||
#[inline]
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where S: Serializer
|
||||
{
|
||||
self.borrow().serialize(serializer)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<T> Serialize for Mutex<T>
|
||||
where T: Serialize
|
||||
{
|
||||
#[inline]
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
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<T> Serialize for RwLock<T>
|
||||
where T: Serialize
|
||||
{
|
||||
#[inline]
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where S: Serializer
|
||||
{
|
||||
match self.read() {
|
||||
Ok(locked) => locked.serialize(serializer),
|
||||
Err(_) => Err(S::Error::custom("lock poison error while serializing")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
>>>>>>> origin/master
|
||||
|
||||
impl<T, E> Serialize for Result<T, E>
|
||||
where
|
||||
|
@ -68,6 +68,10 @@
|
||||
//! - Rc\<T\>
|
||||
//! - Arc\<T\>
|
||||
//! - Cow\<'a, T\>
|
||||
//! - Cell\<T\>
|
||||
//! - RefCell\<T\>
|
||||
//! - Mutex\<T\>
|
||||
//! - RwLock\<T\>
|
||||
//! - **Collection types**:
|
||||
//! - BTreeMap\<K, V\>
|
||||
//! - BTreeSet\<T\>
|
||||
|
@ -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 <erick.tryzelaar@gmail.com>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"
|
||||
|
@ -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 <erick.tryzelaar@gmail.com>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
description = "Token De/Serializer for testing De/Serialize implementations"
|
||||
|
Loading…
x
Reference in New Issue
Block a user