diff options
| -rw-r--r-- | CHANGELOG.md | 37 | ||||
| -rw-r--r-- | src/builder/edit_role.rs | 33 | ||||
| -rw-r--r-- | src/model/utils.rs | 4 |
3 files changed, 41 insertions, 33 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a6fdd1..40af1e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,36 @@ All notable changes to this project will be documented in this file. This project mostly adheres to [Semantic Versioning][semver]. +## [0.4.5] - 2017-12-09 + +This release contains a hotfix for the hotfix release, as well as a slight +behaviour change to the `EditRole` builder. + +The last release contained a deserialization implementation fix which seemed to +work after running tests, but it turns out that not all deserialization issues +were fixed. + +The `EditRole` builder's Default implementation no longer sets a value for each +field, as this causes problems with stateless editing of roles. + +### Fixed + +- [model] Fix remaining deserializers [c:52403a5] + +### Changed + +- [builder] Remove `EditRole::default` implementation [c:795eaa1] + +## [0.4.4] - 2017-12-09 + +This release contains a hotfix for snowflake deserialization on `serde_json` +v1.0.8. Primary development is continuing on the v0.5.x branch and the +[library organization]. + +### Fixed + +- [model] Fix snowflake deserializer [c:77f462e] + ## [0.4.3] - 2017-11-01 This release contains bugfixes and marks the final release of the v0.4.x branch. @@ -1511,6 +1541,7 @@ rest::get_guilds(GuildPagination::After(GuildId(777)), 50); Initial commit. +[0.4.4]: https://github.com/zeyla/serenity/compare/v0.4.3...v0.4.4 [0.4.3]: https://github.com/zeyla/serenity/compare/v0.4.2...v0.4.3 [0.4.2]: https://github.com/zeyla/serenity/compare/v0.4.1...v0.4.2 [0.4.1]: https://github.com/zeyla/serenity/compare/v0.4.0...v0.4.1 @@ -1524,6 +1555,7 @@ Initial commit. [0.1.1]: https://github.com/zeyla/serenity/compare/v0.1.0...v0.1.1 [0.1.0]: https://github.com/zeyla/serenity/tree/403d65d5e98bdfa9f0c018610000c4a0b0c7d8d5 [crates.io listing]: https://crates.io/crates/serenity +[library organization]: https://github.com/serenity-rs [semver]: http://semver.org [issue:56]: https://github.com/zeyla/serenity/issues/56 @@ -1562,6 +1594,11 @@ Initial commit. [@xentec]: https://github.com/xentec [@zeyla]: https://github.com/zeyla +[c:52403a5]: https://github.com/zeyla/serenity/commit/52403a5084ed7f0589bde3351844907a92de2d62 +[c:795eaa1]: https://github.com/zeyla/serenity/commit/795eaa15bca61116fbde9c2482c765f2d47a7696 + +[c:77f462e]: https://github.com/zeyla/serenity/commit/77f462ea2044ef7d2d12fd1289ea75a6a33cb5dd + [c:1b7101f]: https://github.com/zeyla/serenity/commit/1b7101fe71335c0e18bf855c0703acc23d87e427 [c:2ba4d03]: https://github.com/zeyla/serenity/commit/2ba4d03f15d57d9f0fb1cc4d4f4355ebbc483d0a [c:3be6e2e]: https://github.com/zeyla/serenity/commit/3be6e2e28b0c3e9baaef19f405c463e3a41fed25 diff --git a/src/builder/edit_role.rs b/src/builder/edit_role.rs index 856ef27..7e2ff17 100644 --- a/src/builder/edit_role.rs +++ b/src/builder/edit_role.rs @@ -1,7 +1,6 @@ use internal::prelude::*; use std::collections::HashMap; -use std::default::Default; -use model::{permissions, Permissions, Role}; +use model::{Permissions, Role}; /// A builer to create or edit a [`Role`] for use via a number of model methods. /// @@ -39,7 +38,7 @@ use model::{permissions, Permissions, Role}; /// [`GuildId::edit_role`]: ../model/struct.GuildId.html#method.edit_role /// [`Role`]: ../model/struct.Role.html /// [`Role::edit`]: ../model/struct.Role.html#method.edit -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub struct EditRole(pub HashMap<&'static str, Value>); impl EditRole { @@ -114,31 +113,3 @@ impl EditRole { self } } - -impl Default for EditRole { - /// Creates a builder with default parameters. - /// - /// The defaults are: - /// - /// - **color**: 10070709 - /// - **hoist**: false - /// - **mentionable**: false - /// - **name**: new role - /// - **permissions**: the [general permissions set] - /// - **position**: 1 - /// - /// [general permissions set]: ../model/permissions/constant.PRESET_GENERAL.html - fn default() -> EditRole { - let mut map = HashMap::new(); - let permissions = Number::from(permissions::PRESET_GENERAL.bits()); - - map.insert("color", Value::Number(Number::from(10_070_709))); - map.insert("hoist", Value::Bool(false)); - map.insert("mentionable", Value::Bool(false)); - map.insert("name", Value::String("new role".to_string())); - map.insert("permissions", Value::Number(permissions)); - map.insert("position", Value::Number(Number::from(1))); - - EditRole(map) - } -} diff --git a/src/model/utils.rs b/src/model/utils.rs index af54b37..52e3bbc 100644 --- a/src/model/utils.rs +++ b/src/model/utils.rs @@ -126,11 +126,11 @@ pub fn deserialize_users<'de, D: Deserializer<'de>>( } pub fn deserialize_u16<'de, D: Deserializer<'de>>(deserializer: D) -> StdResult<u16, D::Error> { - deserializer.deserialize_u16(U16Visitor) + deserializer.deserialize_any(U16Visitor) } pub fn deserialize_u64<'de, D: Deserializer<'de>>(deserializer: D) -> StdResult<u64, D::Error> { - deserializer.deserialize_u64(U64Visitor) + deserializer.deserialize_any(U64Visitor) } pub fn deserialize_voice_states<'de, D: Deserializer<'de>>( |