aboutsummaryrefslogtreecommitdiff
path: root/src/model/gateway.rs
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2017-01-08 19:30:39 -0800
committerAustin Hellyer <[email protected]>2017-01-08 19:30:39 -0800
commit9a80be04a0ba5c6066606286f71285e5aa2949d5 (patch)
tree7e945710f788efdb5af3842e7b24c0c3b26907fb /src/model/gateway.rs
parentAdd more shard logging (diff)
downloadserenity-9a80be04a0ba5c6066606286f71285e5aa2949d5.tar.xz
serenity-9a80be04a0ba5c6066606286f71285e5aa2949d5.zip
Alphabetize model method names
Diffstat (limited to 'src/model/gateway.rs')
-rw-r--r--src/model/gateway.rs40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/model/gateway.rs b/src/model/gateway.rs
index 67a9a42..769045c 100644
--- a/src/model/gateway.rs
+++ b/src/model/gateway.rs
@@ -3,6 +3,26 @@ use super::*;
use ::internal::prelude::*;
impl Game {
+ #[doc(hidden)]
+ pub fn decode(value: Value) -> Result<Option<Game>> {
+ let mut map = into_map(value)?;
+
+ let name = match map.remove("name") {
+ Some(Value::Null) | None => return Ok(None),
+ Some(v) => into_string(v)?,
+ };
+
+ if name.trim().is_empty() {
+ return Ok(None);
+ }
+
+ Ok(Some(Game {
+ name: name,
+ kind: opt(&mut map, "type", GameType::decode)?.unwrap_or(GameType::Playing),
+ url: opt(&mut map, "url", into_string)?,
+ }))
+ }
+
/// Creates a `Game` struct that appears as a `Playing <name>` status.
///
/// **Note**: Maximum `name` length is 128.
@@ -26,26 +46,6 @@ impl Game {
url: Some(url.to_owned()),
}
}
-
- #[doc(hidden)]
- pub fn decode(value: Value) -> Result<Option<Game>> {
- let mut map = into_map(value)?;
-
- let name = match map.remove("name") {
- Some(Value::Null) | None => return Ok(None),
- Some(v) => into_string(v)?,
- };
-
- if name.trim().is_empty() {
- return Ok(None);
- }
-
- Ok(Some(Game {
- name: name,
- kind: opt(&mut map, "type", GameType::decode)?.unwrap_or(GameType::Playing),
- url: opt(&mut map, "url", into_string)?,
- }))
- }
}
impl Presence {