Skip to content

Commit a6c1e04

Browse files
committed
Remove upstream collection traits.
As per rust-lang/rust#18474
1 parent 260ea05 commit a6c1e04

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

src/lib.rs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl TypeMap {
6666
self.data.remove(&TypeId::of::<K>())
6767
}
6868

69-
/// Gets the given key's corresponding entry in the map for in-place manipulation.
69+
/// Get the given key's corresponding entry in the map for in-place manipulation.
7070
pub fn entry<'a, K: Assoc<V>, V: 'static>(&'a mut self) -> Entry<'a, K, V> {
7171
match self.data.entry(TypeId::of::<K>()) {
7272
hashmap::Occupied(e) => Occupied(OccupiedEntry { data: e }),
@@ -79,22 +79,32 @@ impl TypeMap {
7979

8080
/// Get a mutable reference to the underlying HashMap
8181
pub unsafe fn data_mut(&mut self) -> &mut HashMap<TypeId, Box<Any + 'static>> { &mut self.data }
82+
83+
/// Get the number of values stored in the map.
84+
pub fn len(&self) -> uint {
85+
self.data.len()
86+
}
87+
88+
/// Remove all entries from the map.
89+
pub fn clear(&mut self) {
90+
self.data.clear()
91+
}
8292
}
8393

84-
/// A view onto an entry in the map.
94+
/// A view onto an entry in a TypeMap.
8595
pub enum Entry<'a, K, V> {
86-
/// A view onto an occupied entry in the map.
96+
/// A view onto an occupied entry in a TypeMap.
8797
Occupied(OccupiedEntry<'a, K, V>),
88-
/// A view onto an unoccupied entry in the map.
98+
/// A view onto an unoccupied entry in a TypeMap.
8999
Vacant(VacantEntry<'a, K, V>)
90100
}
91101

92-
/// A view onto an occupied entry in the map.
102+
/// A view onto an occupied entry in a TypeMap.
93103
pub struct OccupiedEntry<'a, K, V> {
94104
data: hashmap::OccupiedEntry<'a, TypeId, Box<Any + 'static>>
95105
}
96106

97-
/// A view onto an unoccupied entry in the map.
107+
/// A view onto an unoccupied entry in a TypeMap.
98108
pub struct VacantEntry<'a, K, V> {
99109
data: hashmap::VacantEntry<'a, TypeId, Box<Any + 'static>>
100110
}
@@ -145,18 +155,6 @@ impl<'a, K, V: 'static> VacantEntry<'a, K, V> {
145155
}
146156
}
147157

148-
impl Collection for TypeMap {
149-
fn len(&self) -> uint {
150-
self.data.len()
151-
}
152-
}
153-
154-
impl Mutable for TypeMap {
155-
fn clear(&mut self) {
156-
self.data.clear()
157-
}
158-
}
159-
160158
#[cfg(test)]
161159
mod test {
162160
use super::{TypeMap, Assoc, Occupied, Vacant};

0 commit comments

Comments
 (0)