aboutsummaryrefslogtreecommitdiff
path: root/src/model/channel/guild_channel.rs
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-12-27 18:29:34 +0100
committeracdenisSK <[email protected]>2017-12-27 18:33:29 +0100
commit3a0c8908ce837f6fe64f865a1a7a9de63cbd237c (patch)
treea8597bb4a7d49cfd614a85d3f2b5a95d3df9e055 /src/model/channel/guild_channel.rs
parentUpdate dependencies (diff)
downloadserenity-3a0c8908ce837f6fe64f865a1a7a9de63cbd237c.tar.xz
serenity-3a0c8908ce837f6fe64f865a1a7a9de63cbd237c.zip
Improve performance of builders even further
By negating hashing altogether. The increase is around 1000-ish nanoseconds saved.
Diffstat (limited to 'src/model/channel/guild_channel.rs')
-rw-r--r--src/model/channel/guild_channel.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/model/channel/guild_channel.rs b/src/model/channel/guild_channel.rs
index 9b8371d..c598314 100644
--- a/src/model/channel/guild_channel.rs
+++ b/src/model/channel/guild_channel.rs
@@ -4,7 +4,7 @@ use model::prelude::*;
#[cfg(all(feature = "cache", feature = "model"))]
use CACHE;
#[cfg(feature = "model")]
-use builder::{CreateInvite, CreateMessage, EditChannel, GetMessages};
+use builder::{VecMap, CreateInvite, CreateMessage, EditChannel, GetMessages};
#[cfg(feature = "model")]
use http::{self, AttachmentType};
#[cfg(all(feature = "cache", feature = "model"))]
@@ -116,7 +116,7 @@ impl GuildChannel {
}
}
- let map = serenity_utils::hashmap_to_json_map(f(CreateInvite::default()).0);
+ let map = serenity_utils::vecmap_to_json_map(f(CreateInvite::default()).0);
http::create_invite(self.id.0, &map)
}
@@ -312,12 +312,12 @@ impl GuildChannel {
}
}
- let mut map = HashMap::new();
+ let mut map = VecMap::new();
map.insert("name", Value::String(self.name.clone()));
map.insert("position", Value::Number(Number::from(self.position)));
map.insert("type", Value::String(self.kind.name().to_string()));
- let edited = serenity_utils::hashmap_to_json_map(f(EditChannel(map)).0);
+ let edited = serenity_utils::vecmap_to_json_map(f(EditChannel(map)).0);
match http::edit_channel(self.id.0, &edited) {
Ok(channel) => {