diff options
| author | acdenisSK <[email protected]> | 2017-07-27 08:10:41 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-07-27 08:10:41 +0200 |
| commit | 70b5097aaac85f970c32ceb988dbb5f5d575ee0f (patch) | |
| tree | d2f391d3b552cfae58b74748a2a2aa5ae80c7986 /src/framework/buckets.rs | |
| parent | rustfmt (diff) | |
| download | serenity-70b5097aaac85f970c32ceb988dbb5f5d575ee0f.tar.xz serenity-70b5097aaac85f970c32ceb988dbb5f5d575ee0f.zip | |
Change the config a bit, and a few nitpicks
Diffstat (limited to 'src/framework/buckets.rs')
| -rw-r--r-- | src/framework/buckets.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/framework/buckets.rs b/src/framework/buckets.rs index 95b832b..4719b85 100644 --- a/src/framework/buckets.rs +++ b/src/framework/buckets.rs @@ -4,6 +4,12 @@ use std::default::Default; use client::Context; use model::{ChannelId, GuildId, UserId}; +#[cfg(feature = "cache")] +type Check = Fn(&mut Context, Option<GuildId>, ChannelId, UserId) -> bool + 'static; + +#[cfg(not(feature = "cache"))] +type Check = Fn(&mut Context, ChannelId, UserId) -> bool + 'static; + pub(crate) struct Ratelimit { pub delay: i64, pub limit: Option<(i64, i32)>, @@ -19,11 +25,7 @@ pub(crate) struct MemberRatelimit { pub(crate) struct Bucket { pub ratelimit: Ratelimit, pub users: HashMap<u64, MemberRatelimit>, - #[cfg(feature = "cache")] - pub check: - Option<Box<Fn(&mut Context, Option<GuildId>, ChannelId, UserId) -> bool + 'static>>, - #[cfg(not(feature = "cache"))] - pub checK: Option<Box<Fn(&mut Context, ChannelId, UserId) -> bool + 'static>>, + pub check: Option<Box<Check>>, } impl Bucket { |