diff --git a/src/lib.rs b/src/lib.rs index 8be503e..b677319 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,7 +13,7 @@ extern crate test; use std::any::Any; use std::intrinsics::TypeId; -use std::collections::HashMap; +use std::collections::{Collection, HashMap, Mutable}; use std::hash::{Hash, Hasher, Writer}; use std::mem::{transmute, transmute_copy}; use std::raw::TraitObject; @@ -144,6 +144,22 @@ impl AnyMap { } } +impl Collection for AnyMap { + fn len(&self) -> uint { + self.data.len() + } + + fn is_empty(&self) -> bool { + self.data.is_empty() + } +} + +impl Mutable for AnyMap { + fn clear(&mut self) { + self.data.clear(); + } +} + #[bench] fn bench_insertion(b: &mut ::test::Bencher) { b.iter(|| {