aboutsummaryrefslogtreecommitdiff
path: root/src/client/bridge
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-12-16 08:39:36 -0800
committerZeyla Hellyer <[email protected]>2017-12-16 08:45:26 -0800
commitbcd16dddb8cc3086a13524c79676f3a8bebbc524 (patch)
tree42d254fb4738df957c4b7d9e5766d1cb5bd47323 /src/client/bridge
parentFix guild deserialization tests (diff)
downloadserenity-bcd16dddb8cc3086a13524c79676f3a8bebbc524.tar.xz
serenity-bcd16dddb8cc3086a13524c79676f3a8bebbc524.zip
Break up the model module
The `model` module has historically been one giant module re-exporting all of the model types, which is somewhere around 100 types. This can be a lot to look at for a new user and somewhat overwhelming, especially with a large number of fine-grained imports from the module. The module is now neatly split up into submodules, mostly like it has been internally since the early versions of the library. The submodules are: - application - channel - error - event - gateway - guild - id - invite - misc - permissions - prelude - user - voice - webhook Each submodule contains types that are "owned" by the module. For example, the `guild` submodule contains, but not limited to, Emoji, AuditLogsEntry, Role, and Member. `channel` contains, but not limited to, Attachment, Embed, Message, and Reaction. Upgrade path: Instead of glob importing the models via `use serenity::model::*;`, instead glob import via the prelude: ```rust use serenity::model::prelude::*; ``` Instead of importing from the root model module: ```rust use serenity::model::{Guild, Message, OnlineStatus, Role, User}; ``` instead import from the submodules like so: ```rust use serenity::model::channel::Message; use serenity::model::guild::{Guild, Role}; use serenity::model::user::{OnlineStatus, User}; ```
Diffstat (limited to 'src/client/bridge')
-rw-r--r--src/client/bridge/gateway/shard_messenger.rs10
-rw-r--r--src/client/bridge/gateway/shard_runner_message.rs4
2 files changed, 8 insertions, 6 deletions
diff --git a/src/client/bridge/gateway/shard_messenger.rs b/src/client/bridge/gateway/shard_messenger.rs
index 069c838..a4b63f3 100644
--- a/src/client/bridge/gateway/shard_messenger.rs
+++ b/src/client/bridge/gateway/shard_messenger.rs
@@ -1,4 +1,4 @@
-use model::{Game, GuildId, OnlineStatus};
+use model::prelude::*;
use super::{ShardClientMessage, ShardRunnerMessage};
use std::sync::mpsc::{SendError, Sender};
use websocket::message::OwnedMessage;
@@ -62,7 +62,7 @@ impl ShardMessenger {
/// #
/// # let mut shard = Shard::new(mutex.clone(), mutex, [0, 1])?;
/// #
- /// use serenity::model::GuildId;
+ /// use serenity::model::id::GuildId;
///
/// let guild_ids = vec![GuildId(81384788765712384)];
///
@@ -92,7 +92,7 @@ impl ShardMessenger {
/// #
/// # let mut shard = Shard::new(mutex.clone(), mutex, [0, 1])?;
/// #
- /// use serenity::model::GuildId;
+ /// use serenity::model::id::GuildId;
///
/// let guild_ids = vec![GuildId(81384788765712384)];
///
@@ -146,7 +146,7 @@ impl ShardMessenger {
/// #
/// # let mut shard = Shard::new(mutex.clone(), mutex, [0, 1]).unwrap();
/// #
- /// use serenity::model::Game;
+ /// use serenity::model::gateway::Game;
///
/// shard.set_game(Some(Game::playing("Heroes of the Storm")));
/// # Ok(())
@@ -227,7 +227,7 @@ impl ShardMessenger {
/// #
/// # let mut shard = Shard::new(mutex.clone(), mutex, [0, 1]).unwrap();
/// #
- /// use serenity::model::OnlineStatus;
+ /// use serenity::model::user::OnlineStatus;
///
/// shard.set_status(OnlineStatus::DoNotDisturb);
/// # Ok(())
diff --git a/src/client/bridge/gateway/shard_runner_message.rs b/src/client/bridge/gateway/shard_runner_message.rs
index e6458eb..5c5512d 100644
--- a/src/client/bridge/gateway/shard_runner_message.rs
+++ b/src/client/bridge/gateway/shard_runner_message.rs
@@ -1,4 +1,6 @@
-use model::{Game, GuildId, OnlineStatus};
+use model::gateway::Game;
+use model::user::OnlineStatus;
+use model::id::GuildId;
use websocket::message::OwnedMessage;
/// A message to send from a shard over a WebSocket.