aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLakelezz <[email protected]>2018-12-10 17:10:53 +0100
committerAlex M. M <[email protected]>2018-12-10 17:10:53 +0100
commit8903dd8efc87d9ed040a452cdaced2dad985700e (patch)
tree1fb067b379cf1b6a229fa9f89950ddd807fd87e5 /src
parentFix User::_nick_in with no-cache (#446) (diff)
downloadserenity-8903dd8efc87d9ed040a452cdaced2dad985700e.tar.xz
serenity-8903dd8efc87d9ed040a452cdaced2dad985700e.zip
Mutably borrow on `ChannelId`'s `edit`-method. (#447)
Diffstat (limited to 'src')
-rw-r--r--src/model/channel/channel_id.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/model/channel/channel_id.rs b/src/model/channel/channel_id.rs
index 63e1d1d..782ea5b 100644
--- a/src/model/channel/channel_id.rs
+++ b/src/model/channel/channel_id.rs
@@ -236,8 +236,11 @@ impl ChannelId {
/// [Manage Channel]: ../permissions/struct.Permissions.html#associatedconstant.MANAGE_CHANNELS
#[cfg(feature = "utils")]
#[inline]
- pub fn edit<F: FnOnce(EditChannel) -> EditChannel>(&self, f: F) -> Result<GuildChannel> {
- let map = utils::vecmap_to_json_map(f(EditChannel::default()).0);
+ pub fn edit<F: FnOnce(&mut EditChannel) -> &mut EditChannel>(&self, f: F) -> Result<GuildChannel> {
+ let mut channel = EditChannel::default();
+ f(&mut channel);
+
+ let map = utils::vecmap_to_json_map(channel.0);
http::edit_channel(self.0, &map)
}