From 5ccfaaa3b1a030b1fd0dcd364bdae001347d36e4 Mon Sep 17 00:00:00 2001 From: Austin Hellyer Date: Tue, 15 Nov 2016 11:36:53 -0800 Subject: Add state/framework/etc. conditional compile flags This adds conditional compilation for the following features, in addition to the voice conditional compilation flag: - extras (message builder) - framework - methods - state These 4 are enabled _by default_, while the `voice` feature flag is disabled. Disabling the state will allow incredibly low-memory bots. --- src/ext/mod.rs | 9 ++++++++- src/ext/state/mod.rs | 6 ++---- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src/ext') diff --git a/src/ext/mod.rs b/src/ext/mod.rs index bb87911..312074b 100644 --- a/src/ext/mod.rs +++ b/src/ext/mod.rs @@ -5,10 +5,17 @@ //! //! See each extension's module-level documentation for more information. //! +//! Note that the framework module requires the `framework` feature to be +//! enabled (enabled by default), the state requires the `state` feature to be +//! enabled (enabled by default), and voice support requires the `voice` feature +//! to be enabled (disabled by default). +//! //! [`Client`]: ../client/struct.Client.html //! [`Connection`]: ../client/struct.Connection.html +#[cfg(feature = "framework")] pub mod framework; +#[cfg(feature = "state")] pub mod state; -#[cfg(feature="voice")] +#[cfg(feature = "voice")] pub mod voice; diff --git a/src/ext/state/mod.rs b/src/ext/state/mod.rs index fa38b6f..5c56a54 100644 --- a/src/ext/state/mod.rs +++ b/src/ext/state/mod.rs @@ -166,7 +166,7 @@ impl State { self.update_with_guild_member_remove(event); }, Event::GuildMemberUpdate(ref event) => { - self.update_with_guild_member_update(event, false); + self.update_with_guild_member_update(event); }, Event::GuildMembersChunk(ref event) => { self.update_with_guild_members_chunk(event); @@ -448,10 +448,8 @@ impl State { } pub fn update_with_guild_member_update(&mut self, - event: &GuildMemberUpdateEvent, - old: bool) + event: &GuildMemberUpdateEvent) -> Option { - if let Some(guild) = self.guilds.get_mut(&event.guild_id) { let mut found = false; -- cgit v1.2.3