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/model/id.rs | |
| 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/model/id.rs')
| -rw-r--r-- | src/model/id.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/model/id.rs b/src/model/id.rs index 8f925de..8c94dec 100644 --- a/src/model/id.rs +++ b/src/model/id.rs @@ -9,15 +9,15 @@ impl ChannelId { /// Search the state for the channel with the Id. #[cfg(feature="methods")] pub fn find(&self) -> Option<Channel> { - STATE.lock().unwrap().find_channel(*self) + STATE.lock().unwrap().get_channel(*self) } /// Search the state for the channel. If it can't be found, the channel is /// requested over REST. #[cfg(feature="methods")] pub fn get(&self) -> Result<Channel> { - if let Some(channel) = STATE.lock().unwrap().find_channel(*self) { - return Ok(channel); + if let Some(channel) = STATE.lock().unwrap().get_channel(*self) { + return Ok(channel.clone()); } http::get_channel(self.0) @@ -74,11 +74,10 @@ impl From<Emoji> for EmojiId { } impl GuildId { - /// Search the state for the guild. #[cfg(feature="methods")] pub fn find(&self) -> Option<LiveGuild> { - STATE.lock().unwrap().find_guild(*self).cloned() + STATE.lock().unwrap().get_guild(*self).cloned() } /// Requests the guild over REST. |