-#[cfg_attr(feature = "clone", derive(Clone))]
-pub struct RawAnyMap {
- inner: HashMap<TypeId, Box<Any>, TypeIdState>,
+pub struct RawMap<A: ?Sized + UncheckedAnyExt = Any> {
+ #[cfg(feature = "unstable")]
+ inner: HashMap<TypeId, Box<A>, TypeIdState>,
+
+ #[cfg(not(feature = "unstable"))]
+ inner: HashMap<TypeId, Box<A>>,
+}
+
+// #[derive(Clone)] would want A to implement Clone, but in reality it’s only Box<A> that can.
+impl<A: ?Sized + UncheckedAnyExt> Clone for RawMap<A> where Box<A>: Clone {
+ fn clone(&self) -> RawMap<A> {
+ RawMap {
+ inner: self.inner.clone(),
+ }
+ }