aboutsummaryrefslogtreecommitdiff
path: root/src/client/dispatch.rs
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-08-10 09:06:28 +0200
committeracdenisSK <[email protected]>2017-08-10 09:06:56 +0200
commiteee857a855831851599e5196750b27b26151eb16 (patch)
tree12c87e91559b682b4f5a27d26fa423e325bc2b28 /src/client/dispatch.rs
parentRemove the `I` bound for the language param and fix `push_mono_safe` (diff)
downloadserenity-eee857a855831851599e5196750b27b26151eb16.tar.xz
serenity-eee857a855831851599e5196750b27b26151eb16.zip
Split event handling in the cache to a trait
note: This trait might become like `framework::Framework` in the future.
Diffstat (limited to 'src/client/dispatch.rs')
-rw-r--r--src/client/dispatch.rs22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/client/dispatch.rs b/src/client/dispatch.rs
index aec821a..ad3660e 100644
--- a/src/client/dispatch.rs
+++ b/src/client/dispatch.rs
@@ -16,21 +16,15 @@ use Framework;
#[cfg(feature = "cache")]
use super::CACHE;
+#[cfg(feature = "cache")]
+use super::super::CacheEventsImpl;
macro_rules! update {
($method:ident, @$event:expr) => {
{
#[cfg(feature="cache")]
{
- CACHE.write().unwrap().$method(&mut $event)
- }
- }
- };
- ($method:ident, @$event:expr, $old:expr) => {
- {
- #[cfg(feature="cache")]
- {
- CACHE.write().unwrap().$method(&mut $event, $old)
+ CacheEventsImpl::$method(&mut *CACHE.write().unwrap(), &mut $event)
}
}
};
@@ -38,15 +32,7 @@ macro_rules! update {
{
#[cfg(feature="cache")]
{
- CACHE.write().unwrap().$method(&$event)
- }
- }
- };
- ($method:ident, $event:expr, $old:expr) => {
- {
- #[cfg(feature="cache")]
- {
- CACHE.write().unwrap().$method(&$event, $old)
+ CacheEventsImpl::$method(&mut *CACHE.write().unwrap(), &$event)
}
}
};