diff options
| author | Austin Hellyer <[email protected]> | 2016-11-19 20:50:33 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-19 20:50:33 -0800 |
| commit | 66f4acc63163a5f7bd528165ee5fe9ae7d44eb7d (patch) | |
| tree | 357b4f4632138b6e0270c177cccd445b1c4f2d98 /src/ext | |
| parent | Fix type errors for non-framework builds (diff) | |
| download | serenity-66f4acc63163a5f7bd528165ee5fe9ae7d44eb7d.tar.xz serenity-66f4acc63163a5f7bd528165ee5fe9ae7d44eb7d.zip | |
Rename state methods from find_ to get_
For consistency with the rest of the library, rename the methods
prefixed with `find_` to `get_`.
The past logic was that items are "found", as they may or may not exist.
With get, the expectation is that it is _always_ there, i.e. over REST.
However, this is inconsistent, and "get"ting over REST can fail for
other reasons.
Diffstat (limited to 'src/ext')
| -rw-r--r-- | src/ext/state/mod.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ext/state/mod.rs b/src/ext/state/mod.rs index ce25e2a..637729c 100644 --- a/src/ext/state/mod.rs +++ b/src/ext/state/mod.rs @@ -109,11 +109,11 @@ impl State { .collect::<Vec<_>>() } - pub fn find_call<C: Into<ChannelId>>(&self, group_id: C) -> Option<&Call> { + pub fn get_call<C: Into<ChannelId>>(&self, group_id: C) -> Option<&Call> { self.calls.get(&group_id.into()) } - pub fn find_channel<C: Into<ChannelId>>(&self, id: C) -> Option<Channel> { + pub fn get_channel<C: Into<ChannelId>>(&self, id: C) -> Option<Channel> { let id = id.into(); for guild in self.guilds.values() { @@ -127,16 +127,16 @@ impl State { None } - pub fn find_guild<G: Into<GuildId>>(&self, id: G) -> Option<&LiveGuild> { + pub fn get_guild<G: Into<GuildId>>(&self, id: G) -> Option<&LiveGuild> { self.guilds.get(&id.into()) } - pub fn find_group<C: Into<ChannelId>>(&self, id: C) -> Option<&Group> { + pub fn get_group<C: Into<ChannelId>>(&self, id: C) -> Option<&Group> { self.groups.get(&id.into()) } - pub fn find_member<G, U>(&self, guild_id: G, user_id: U) - -> Option<&Member> where G: Into<GuildId>, U: Into<UserId> { + pub fn get_member<G, U>(&self, guild_id: G, user_id: U) -> Option<&Member> + where G: Into<GuildId>, U: Into<UserId> { self.guilds .get(&guild_id.into()) .map(|guild| { @@ -147,7 +147,7 @@ impl State { }) } - pub fn find_role<G, R>(&self, guild_id: G, role_id: R) -> Option<&Role> + pub fn get_role<G, R>(&self, guild_id: G, role_id: R) -> Option<&Role> where G: Into<GuildId>, R: Into<RoleId> { if let Some(guild) = self.guilds.get(&guild_id.into()) { guild.roles.get(&role_id.into()) |