#[doc(hidden)] #[macro_export] macro_rules! impl_typemap { ($map:ident, $key:ty) => { pub struct $map($crate::base::TypeMapBase); impl $crate::typemap_trait::TypeMapTrait for $map { type Key = $key; #[inline] fn new() -> Self { Self($crate::base::TypeMapBase::new()) } #[inline] fn insert>( &mut self, value: T::Value, ) { let mto = value.into_mto(); self.0.insert::(mto); } #[inline] fn get>(&self) -> Option<&T::Value> { self.0.get::().and_then(|v| v.downcast_ref()) } #[inline] fn get_mut>( &mut self, ) -> Option<&mut T::Value> { self.0.get_mut::().and_then(|v| v.downcast_mut()) } #[inline] fn remove>( &mut self, ) -> Option { self.0.remove::().and_then(|v| v.downcast()) } #[inline] fn contains_key>(&self) -> bool { self.0.contains_key::() } } }; }