aboutsummaryrefslogtreecommitdiff
path: root/src/http
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/http
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/http')
-rw-r--r--src/http/mod.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/http/mod.rs b/src/http/mod.rs
index d79f7fd..5288f5c 100644
--- a/src/http/mod.rs
+++ b/src/http/mod.rs
@@ -39,7 +39,7 @@ use hyper::net::HttpsConnector;
use hyper::{header, Error as HyperError, Result as HyperResult, Url};
use hyper_native_tls::NativeTlsClient;
use internal::prelude::*;
-use model::*;
+use model::prelude::*;
use multipart::client::Multipart;
use parking_lot::Mutex;
use self::ratelimiting::Route;
@@ -524,7 +524,7 @@ pub fn delete_messages(channel_id: u64, map: &Value) -> Result<()> {
///
/// ```rust,no_run
/// use serenity::http;
-/// use serenity::model::{ChannelId, MessageId};
+/// use serenity::model::id::{ChannelId, MessageId};
///
/// let channel_id = ChannelId(7);
/// let message_id = MessageId(8);
@@ -1342,7 +1342,7 @@ pub fn get_guild_webhooks(guild_id: u64) -> Result<Vec<Webhook>> {
///
/// ```rust,no_run
/// use serenity::http::{GuildPagination, get_guilds};
-/// use serenity::model::GuildId;
+/// use serenity::model::id::GuildId;
///
/// let guild_id = GuildId(81384788765712384);
///