Delete Decoder::read_map_elt_val
This commit is contained in:
parent
025e1b581a
commit
8def096c4d
@ -82,7 +82,7 @@ fn decode(d: &mut D) -> BTreeMap<K, V> {
|
|||||||
let mut map = BTreeMap::new();
|
let mut map = BTreeMap::new();
|
||||||
for _ in 0..len {
|
for _ in 0..len {
|
||||||
let key = Decodable::decode(d);
|
let key = Decodable::decode(d);
|
||||||
let val = d.read_map_elt_val(|d| Decodable::decode(d));
|
let val = Decodable::decode(d);
|
||||||
map.insert(key, val);
|
map.insert(key, val);
|
||||||
}
|
}
|
||||||
map
|
map
|
||||||
@ -148,7 +148,7 @@ fn decode(d: &mut D) -> HashMap<K, V, S> {
|
|||||||
let mut map = HashMap::with_capacity_and_hasher(len, state);
|
let mut map = HashMap::with_capacity_and_hasher(len, state);
|
||||||
for _ in 0..len {
|
for _ in 0..len {
|
||||||
let key = Decodable::decode(d);
|
let key = Decodable::decode(d);
|
||||||
let val = d.read_map_elt_val(|d| Decodable::decode(d));
|
let val = Decodable::decode(d);
|
||||||
map.insert(key, val);
|
map.insert(key, val);
|
||||||
}
|
}
|
||||||
map
|
map
|
||||||
@ -227,7 +227,7 @@ fn decode(d: &mut D) -> indexmap::IndexMap<K, V, S> {
|
|||||||
let mut map = indexmap::IndexMap::with_capacity_and_hasher(len, state);
|
let mut map = indexmap::IndexMap::with_capacity_and_hasher(len, state);
|
||||||
for _ in 0..len {
|
for _ in 0..len {
|
||||||
let key = Decodable::decode(d);
|
let key = Decodable::decode(d);
|
||||||
let val = d.read_map_elt_val(|d| Decodable::decode(d));
|
let val = Decodable::decode(d);
|
||||||
map.insert(key, val);
|
map.insert(key, val);
|
||||||
}
|
}
|
||||||
map
|
map
|
||||||
|
@ -225,14 +225,6 @@ fn read_map<T, F>(&mut self, f: F) -> T
|
|||||||
let len = self.read_usize();
|
let len = self.read_usize();
|
||||||
f(self, len)
|
f(self, len)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn read_map_elt_val<T, F>(&mut self, f: F) -> T
|
|
||||||
where
|
|
||||||
F: FnOnce(&mut Self) -> T,
|
|
||||||
{
|
|
||||||
f(self)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Trait for types that can be serialized
|
/// Trait for types that can be serialized
|
||||||
|
Loading…
Reference in New Issue
Block a user