aboutsummaryrefslogtreecommitdiff
path: root/src/model/guild/partial_guild.rs
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-10-14 16:14:43 -0700
committerZeyla Hellyer <[email protected]>2017-10-14 16:14:43 -0700
commit78c6df9ed3640c097ef088519ec99a6a01796bfc (patch)
treea53aea0c11bbbc94941b99b55e831ac2e611dd0f /src/model/guild/partial_guild.rs
parentUpdate to account for changes made in 0.4.1 (diff)
downloadserenity-78c6df9ed3640c097ef088519ec99a6a01796bfc.tar.xz
serenity-78c6df9ed3640c097ef088519ec99a6a01796bfc.zip
Change `features` fields to be a Vec<String>
When Discord adds new features, the Feature enum will not be able to serialize the new values until updated, causing the entire Guild deserialization to fail. Due to the fact that these features can be added at any time, the `features` vector on Guild and PartialGuild have been changed to be a `Vec<String>`. Upgrade path: Instead of matching on variants of Feature like so: ```rust use serenity::model::Feature; for feature in guild.features { if feature == Feature::VipRegions { // do work with this info } } ``` Instead opt to check the string name of the feature: ```rust for feature in guild.features { if feature == "VIP_REGIONS" { // do work with this info } } ```
Diffstat (limited to 'src/model/guild/partial_guild.rs')
-rw-r--r--src/model/guild/partial_guild.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/model/guild/partial_guild.rs b/src/model/guild/partial_guild.rs
index cb2f8ef..6a8717d 100644
--- a/src/model/guild/partial_guild.rs
+++ b/src/model/guild/partial_guild.rs
@@ -17,7 +17,12 @@ pub struct PartialGuild {
pub embed_channel_id: Option<ChannelId>,
pub embed_enabled: bool,
#[serde(deserialize_with = "deserialize_emojis")] pub emojis: HashMap<EmojiId, Emoji>,
- pub features: Vec<Feature>,
+ /// Features enabled for the guild.
+ ///
+ /// Refer to [`Guild::features`] for more information.
+ ///
+ /// [`Guild::features`]: struct.Guild.html#structfield.features
+ pub features: Vec<String>,
pub icon: Option<String>,
pub mfa_level: u64,
pub name: String,