diff --git a/src/extensions.rs b/src/extensions.rs index f7805641b..148e4c18e 100644 --- a/src/extensions.rs +++ b/src/extensions.rs @@ -26,6 +26,11 @@ impl Extensions { self.map.insert(TypeId::of::(), Box::new(val)); } + /// Check if container contains entry + pub fn contains(&self) -> bool { + self.map.get(&TypeId::of::()).is_some() + } + /// Get a reference to a type previously inserted on this `Extensions`. pub fn get(&self) -> Option<&T> { self.map