aboutsummaryrefslogtreecommitdiff
path: root/src/framework/buckets.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/framework/buckets.rs')
-rw-r--r--src/framework/buckets.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/framework/buckets.rs b/src/framework/buckets.rs
index 76a8c0b..95b832b 100644
--- a/src/framework/buckets.rs
+++ b/src/framework/buckets.rs
@@ -2,7 +2,7 @@ use chrono::Utc;
use std::collections::HashMap;
use std::default::Default;
use client::Context;
-use model::{GuildId, ChannelId, UserId};
+use model::{ChannelId, GuildId, UserId};
pub(crate) struct Ratelimit {
pub delay: i64,
@@ -19,16 +19,18 @@ 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"))]
+ #[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>>,
}
impl Bucket {
pub fn take(&mut self, user_id: u64) -> i64 {
let time = Utc::now().timestamp();
- let user = self.users.entry(user_id)
+ let user = self.users
+ .entry(user_id)
.or_insert_with(MemberRatelimit::default);
if let Some((timespan, limit)) = self.ratelimit.limit {