aboutsummaryrefslogtreecommitdiff
path: root/src/model/gateway.rs
diff options
context:
space:
mode:
authorLeah <[email protected]>2018-03-23 13:54:12 +0100
committeralex <[email protected]>2018-03-23 13:54:12 +0100
commitfdcf44e1463e708cd8b612c183e302db9af0febd (patch)
tree1a311f26fb38522ba380881fa6e72c0c2e5c54bc /src/model/gateway.rs
parentFix Create(Embed/Message) to be consistent (diff)
downloadserenity-fdcf44e1463e708cd8b612c183e302db9af0febd.tar.xz
serenity-fdcf44e1463e708cd8b612c183e302db9af0febd.zip
Change the way ids and some enums are made (#295)
This makes them easier to be found by tools like rls. Also update struct inits to use the shorthand version for `x: x`.
Diffstat (limited to 'src/model/gateway.rs')
-rw-r--r--src/model/gateway.rs41
1 files changed, 25 insertions, 16 deletions
diff --git a/src/model/gateway.rs b/src/model/gateway.rs
index 924f27f..e795077 100644
--- a/src/model/gateway.rs
+++ b/src/model/gateway.rs
@@ -144,22 +144,31 @@ impl<'de> Deserialize<'de> for Game {
.and_then(|v| serde_json::from_value::<String>(v).ok());
Ok(Game {
- kind: kind,
- name: name,
- url: url,
+ kind,
+ name,
+ url,
})
}
}
+
+
+/// The type of activity that is being performed when playing a game.
+#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
+pub enum GameType {
+ /// An indicator that the user is playing a game.
+ Playing = 0,
+ /// An indicator that the user is streaming to a service.
+ Streaming = 1,
+ /// An indicator that the user is listening to something.
+ Listening = 2,
+}
+
enum_number!(
- /// The type of activity that is being performed when playing a game.
GameType {
- /// An indicator that the user is playing a game.
- Playing = 0,
- /// An indicator that the user is streaming to a service.
- Streaming = 1,
- /// An indicator that the user is listening to something.
- Listening = 2,
+ Playing,
+ Streaming,
+ Listening,
}
);
@@ -255,12 +264,12 @@ impl<'de> Deserialize<'de> for Presence {
.map_err(DeError::custom)?;
Ok(Presence {
- game: game,
- last_modified: last_modified,
- nick: nick,
- status: status,
- user: user,
- user_id: user_id,
+ game,
+ last_modified,
+ nick,
+ status,
+ user,
+ user_id,
})
}
}