From 0fefb455ea3b722ae052266c98439bb0f6853639 Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Wed, 2 Sep 2020 16:48:21 -0400 Subject: [PATCH] Prelude: do away with GetCloned --- youmubot-prelude/src/lib.rs | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/youmubot-prelude/src/lib.rs b/youmubot-prelude/src/lib.rs index 4b72eac..2532a16 100644 --- a/youmubot-prelude/src/lib.rs +++ b/youmubot-prelude/src/lib.rs @@ -13,42 +13,13 @@ pub use pagination::Pagination; pub use reaction_watch::{ReactionHandler, ReactionWatcher}; /// The global app data. -pub type AppData = Arc>; +pub type AppData = Arc>; /// The HTTP client. pub struct HTTPClient; impl TypeMapKey for HTTPClient { - type Value = reqwest::blocking::Client; -} - -/// The TypeMap trait that allows TypeMaps to quickly get a clonable item. -pub trait GetCloned { - /// Gets an item from the store, cloned. - fn get_cloned(&self) -> T::Value - where - T: TypeMapKey, - T::Value: Clone + Send + Sync; -} - -impl GetCloned for ShareMap { - fn get_cloned(&self) -> T::Value - where - T: TypeMapKey, - T::Value: Clone + Send + Sync, - { - self.get::().cloned().expect("Should be there") - } -} - -impl GetCloned for AppData { - fn get_cloned(&self) -> T::Value - where - T: TypeMapKey, - T::Value: Clone + Send + Sync, - { - self.read().get::().cloned().expect("Should be there") - } + type Value = reqwest::Client; } pub mod prelude_commands {