mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-14 04:41:01 +00:00
VecMap was removed from libcollections
This commit is contained in:
@@ -10,8 +10,6 @@ use std::collections::{
|
|||||||
};
|
};
|
||||||
#[cfg(feature = "nightly")]
|
#[cfg(feature = "nightly")]
|
||||||
use collections::enum_set::{CLike, EnumSet};
|
use collections::enum_set::{CLike, EnumSet};
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
use collections::vec_map::VecMap;
|
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::path;
|
use std::path;
|
||||||
@@ -719,64 +717,6 @@ map_impl!(
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
pub struct VecMapVisitor<V> {
|
|
||||||
marker: PhantomData<VecMap<V>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
impl<V> VecMapVisitor<V> {
|
|
||||||
#[inline]
|
|
||||||
pub fn new() -> Self {
|
|
||||||
VecMapVisitor {
|
|
||||||
marker: PhantomData,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
impl<V> Visitor for VecMapVisitor<V>
|
|
||||||
where V: Deserialize,
|
|
||||||
{
|
|
||||||
type Value = VecMap<V>;
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn visit_unit<E>(&mut self) -> Result<VecMap<V>, E>
|
|
||||||
where E: Error,
|
|
||||||
{
|
|
||||||
Ok(VecMap::new())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn visit_map<V_>(&mut self, mut visitor: V_) -> Result<VecMap<V>, V_::Error>
|
|
||||||
where V_: MapVisitor,
|
|
||||||
{
|
|
||||||
let (len, _) = visitor.size_hint();
|
|
||||||
let mut values = VecMap::with_capacity(len);
|
|
||||||
|
|
||||||
while let Some((key, value)) = try!(visitor.visit()) {
|
|
||||||
values.insert(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
try!(visitor.end());
|
|
||||||
|
|
||||||
Ok(values)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
impl<V> Deserialize for VecMap<V>
|
|
||||||
where V: Deserialize,
|
|
||||||
{
|
|
||||||
fn deserialize<D>(deserializer: &mut D) -> Result<VecMap<V>, D::Error>
|
|
||||||
where D: Deserializer,
|
|
||||||
{
|
|
||||||
deserializer.visit_map(VecMapVisitor::new())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
struct PathBufVisitor;
|
struct PathBufVisitor;
|
||||||
|
|
||||||
impl Visitor for PathBufVisitor {
|
impl Visitor for PathBufVisitor {
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
//! leaving serde to perform roughly the same speed as a hand written serializer for a specific
|
//! leaving serde to perform roughly the same speed as a hand written serializer for a specific
|
||||||
//! type.
|
//! type.
|
||||||
#![doc(html_root_url="https://serde-rs.github.io/serde/serde")]
|
#![doc(html_root_url="https://serde-rs.github.io/serde/serde")]
|
||||||
#![cfg_attr(feature = "nightly", feature(collections, core, enumset, nonzero, step_trait, vecmap, zero_one))]
|
#![cfg_attr(feature = "nightly", feature(collections, core, enumset, nonzero, step_trait, zero_one))]
|
||||||
|
|
||||||
extern crate num;
|
extern crate num;
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ use std::collections::{
|
|||||||
};
|
};
|
||||||
#[cfg(feature = "nightly")]
|
#[cfg(feature = "nightly")]
|
||||||
use collections::enum_set::{CLike, EnumSet};
|
use collections::enum_set::{CLike, EnumSet};
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
use std::collections::vec_map::VecMap;
|
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
#[cfg(feature = "nightly")]
|
#[cfg(feature = "nightly")]
|
||||||
use std::iter;
|
use std::iter;
|
||||||
@@ -558,18 +556,6 @@ impl<K, V> Serialize for HashMap<K, V>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
impl<V> Serialize for VecMap<V>
|
|
||||||
where V: Serialize,
|
|
||||||
{
|
|
||||||
#[inline]
|
|
||||||
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error>
|
|
||||||
where S: Serializer,
|
|
||||||
{
|
|
||||||
serializer.visit_map(MapIteratorVisitor::new(self.iter(), Some(self.len())))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
impl<'a, T: ?Sized> Serialize for &'a T where T: Serialize {
|
impl<'a, T: ?Sized> Serialize for &'a T where T: Serialize {
|
||||||
|
|||||||
Reference in New Issue
Block a user