aboutsummaryrefslogtreecommitdiff
path: root/src/model/utils.rs
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-11-22 07:57:51 -0800
committerAustin Hellyer <[email protected]>2016-11-22 07:57:51 -0800
commitd4726f899cf6b86d805a8a2a77ec57782ec3bdd6 (patch)
tree7966be3c6d6c4284bb618b88b3f146dd412af677 /src/model/utils.rs
parentDon't typo CreateEmbed::image field (diff)
downloadserenity-d4726f899cf6b86d805a8a2a77ec57782ec3bdd6.tar.xz
serenity-d4726f899cf6b86d805a8a2a77ec57782ec3bdd6.zip
Rename the State to Cache
Diffstat (limited to 'src/model/utils.rs')
-rw-r--r--src/model/utils.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/model/utils.rs b/src/model/utils.rs
index db39939..60fa892 100644
--- a/src/model/utils.rs
+++ b/src/model/utils.rs
@@ -19,8 +19,8 @@ use ::utils::{decode_array, into_array};
#[cfg(feature = "methods")]
use super::permissions::{self, Permissions};
-#[cfg(feature = "methods")]
-use ::client::STATE;
+#[cfg(all(feature = "cache", feature = "methods"))]
+use ::client::CACHE;
#[macro_escape]
macro_rules! missing {
@@ -271,14 +271,14 @@ pub fn remove(map: &mut BTreeMap<String, Value>, key: &str) -> Result<Value> {
}
#[doc(hidden)]
-#[cfg(feature="methods")]
+#[cfg(all(feature = "cache", feature="methods"))]
pub fn user_has_perms(channel_id: ChannelId,
mut permissions: Permissions)
-> Result<bool> {
- let state = STATE.lock().unwrap();
- let current_user = &state.user;
+ let cache = CACHE.lock().unwrap();
+ let current_user = &cache.user;
- let channel = match state.get_channel(channel_id) {
+ let channel = match cache.get_channel(channel_id) {
Some(channel) => channel,
None => return Err(Error::Client(ClientError::ItemMissing)),
};
@@ -290,7 +290,7 @@ pub fn user_has_perms(channel_id: ChannelId,
Channel::Public(channel) => channel.guild_id,
};
- let guild = match state.get_guild(guild_id) {
+ let guild = match cache.get_guild(guild_id) {
Some(guild) => guild,
None => return Err(Error::Client(ClientError::ItemMissing)),
};