Skip to content
This repository was archived by the owner on Dec 1, 2023. It is now read-only.

Commit c66eba1

Browse files
committed
Remove serialization support for old_path and HashState
The `std::old_path` module is on its way out and the `HashState` portions of hash maps is likely not going to be stable for 1.0. Once the functionality is stabilized it can return to this crate.
1 parent 9564779 commit c66eba1

File tree

3 files changed

+9
-48
lines changed

3 files changed

+9
-48
lines changed

src/collection_impls.rs

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010

1111
//! Implementations of serialization for structures found in libcollections
1212
13-
use std::default::Default;
1413
use std::hash::Hash;
1514

1615
use {Decodable, Encodable, Decoder, Encoder};
1716
use std::collections::{LinkedList, VecDeque, BTreeMap, BTreeSet, HashMap, HashSet, VecMap};
18-
use std::collections::hash_state::HashState;
1917

2018
impl<
2119
T: Encodable
@@ -128,10 +126,9 @@ impl<
128126
}
129127
}
130128

131-
impl<K, V, S> Encodable for HashMap<K, V, S>
129+
impl<K, V> Encodable for HashMap<K, V>
132130
where K: Encodable + Hash + Eq,
133131
V: Encodable,
134-
S: HashState,
135132
{
136133
fn encode<E: Encoder>(&self, e: &mut E) -> Result<(), E::Error> {
137134
e.emit_map(self.len(), |e| {
@@ -146,15 +143,13 @@ impl<K, V, S> Encodable for HashMap<K, V, S>
146143
}
147144
}
148145

149-
impl<K, V, S> Decodable for HashMap<K, V, S>
146+
impl<K, V> Decodable for HashMap<K, V>
150147
where K: Decodable + Hash + Eq,
151148
V: Decodable,
152-
S: HashState + Default,
153149
{
154-
fn decode<D: Decoder>(d: &mut D) -> Result<HashMap<K, V, S>, D::Error> {
150+
fn decode<D: Decoder>(d: &mut D) -> Result<HashMap<K, V>, D::Error> {
155151
d.read_map(|d, len| {
156-
let state = Default::default();
157-
let mut map = HashMap::with_capacity_and_hash_state(len, state);
152+
let mut map = HashMap::with_capacity(len);
158153
for i in 0..len {
159154
let key = try!(d.read_map_elt_key(i, |d| Decodable::decode(d)));
160155
let val = try!(d.read_map_elt_val(i, |d| Decodable::decode(d)));
@@ -165,10 +160,7 @@ impl<K, V, S> Decodable for HashMap<K, V, S>
165160
}
166161
}
167162

168-
impl<T, S> Encodable for HashSet<T, S>
169-
where T: Encodable + Hash + Eq,
170-
S: HashState,
171-
{
163+
impl<T> Encodable for HashSet<T> where T: Encodable + Hash + Eq {
172164
fn encode<E: Encoder>(&self, s: &mut E) -> Result<(), E::Error> {
173165
s.emit_seq(self.len(), |s| {
174166
let mut i = 0;
@@ -181,14 +173,10 @@ impl<T, S> Encodable for HashSet<T, S>
181173
}
182174
}
183175

184-
impl<T, S> Decodable for HashSet<T, S>
185-
where T: Decodable + Hash + Eq,
186-
S: HashState + Default,
187-
{
188-
fn decode<D: Decoder>(d: &mut D) -> Result<HashSet<T, S>, D::Error> {
176+
impl<T> Decodable for HashSet<T> where T: Decodable + Hash + Eq, {
177+
fn decode<D: Decoder>(d: &mut D) -> Result<HashSet<T>, D::Error> {
189178
d.read_seq(|d, len| {
190-
let state = Default::default();
191-
let mut set = HashSet::with_capacity_and_hash_state(len, state);
179+
let mut set = HashSet::with_capacity(len);
192180
for i in 0..len {
193181
set.insert(try!(d.read_seq_elt(i, |d| Decodable::decode(d))));
194182
}

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//! Support code for encoding and decoding types.
1212
13-
#![feature(core, collections, unicode, io, std_misc, old_path, path, os)]
13+
#![feature(core, collections, unicode, io, std_misc, path, os)]
1414
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
1515
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
1616
html_root_url = "http://doc.rust-lang.org/rustc-serialize/")]

src/serialize.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Core encoding and decoding interfaces.
1616

1717
use std::cell::{Cell, RefCell};
1818
use std::ffi::{AsOsStr, OsString};
19-
use std::old_path::{PosixPath, WindowsPath};
2019
use std::path;
2120
use std::rc::Rc;
2221
use std::sync::Arc;
@@ -540,32 +539,6 @@ macro_rules! tuple {
540539

541540
tuple! { T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, }
542541

543-
impl Encodable for PosixPath {
544-
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
545-
self.as_vec().encode(e)
546-
}
547-
}
548-
549-
impl Decodable for PosixPath {
550-
fn decode<D: Decoder>(d: &mut D) -> Result<PosixPath, D::Error> {
551-
let bytes: Vec<u8> = try!(Decodable::decode(d));
552-
Ok(PosixPath::new(bytes))
553-
}
554-
}
555-
556-
impl Encodable for WindowsPath {
557-
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
558-
self.as_vec().encode(e)
559-
}
560-
}
561-
562-
impl Decodable for WindowsPath {
563-
fn decode<D: Decoder>(d: &mut D) -> Result<WindowsPath, D::Error> {
564-
let bytes: Vec<u8> = try!(Decodable::decode(d));
565-
Ok(WindowsPath::new(bytes))
566-
}
567-
}
568-
569542
impl Encodable for path::Path {
570543
#[cfg(unix)]
571544
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {

0 commit comments

Comments
 (0)