aboutsummaryrefslogtreecommitdiff
path: root/src/gateway
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2018-03-29 12:10:43 +0200
committeracdenisSK <[email protected]>2018-03-29 12:11:23 +0200
commit4c05e828d5191975ef1a5e1ac581b646a69d2c25 (patch)
treefb583f88a1e5d192651b399aca1839f3f58e661e /src/gateway
parentAdd a connection timeout (diff)
downloadserenity-4c05e828d5191975ef1a5e1ac581b646a69d2c25.tar.xz
serenity-4c05e828d5191975ef1a5e1ac581b646a69d2c25.zip
Refactor imports/exports to use nested groups and better formatting
Diffstat (limited to 'src/gateway')
-rw-r--r--src/gateway/error.rs10
-rw-r--r--src/gateway/mod.rs20
-rw-r--r--src/gateway/shard.rs26
3 files changed, 37 insertions, 19 deletions
diff --git a/src/gateway/error.rs b/src/gateway/error.rs
index b75c5d4..4a6d1b6 100644
--- a/src/gateway/error.rs
+++ b/src/gateway/error.rs
@@ -1,5 +1,11 @@
-use std::error::Error as StdError;
-use std::fmt::{Display, Formatter, Result as FmtResult};
+use std::{
+ error::Error as StdError,
+ fmt::{
+ Display,
+ Formatter,
+ Result as FmtResult
+ }
+};
use websocket::message::CloseData;
/// An error that occurred while attempting to deal with the gateway.
diff --git a/src/gateway/mod.rs b/src/gateway/mod.rs
index c4748a0..ffacba7 100644
--- a/src/gateway/mod.rs
+++ b/src/gateway/mod.rs
@@ -53,16 +53,22 @@ mod error;
mod shard;
mod ws_client_ext;
-pub use self::error::Error as GatewayError;
-pub use self::shard::Shard;
-pub use self::ws_client_ext::WebSocketGatewayClientExt;
+pub use self::{
+ error::Error as GatewayError,
+ shard::Shard,
+ ws_client_ext::WebSocketGatewayClientExt
+};
-use model::gateway::Game;
-use model::user::OnlineStatus;
+use model::{
+ gateway::Game,
+ user::OnlineStatus
+};
use serde_json::Value;
use std::fmt::{Display, Formatter, Result as FmtResult};
-use websocket::sync::client::Client;
-use websocket::sync::stream::{TcpStream, TlsStream};
+use websocket::sync::{
+ client::Client,
+ stream::{TcpStream, TlsStream}
+};
#[cfg(feature = "client")]
use client::bridge::gateway::ShardClientMessage;
diff --git a/src/gateway/shard.rs b/src/gateway/shard.rs
index aee2bd0..88f8743 100644
--- a/src/gateway/shard.rs
+++ b/src/gateway/shard.rs
@@ -1,12 +1,16 @@
use constants::{self, close_codes};
use internal::prelude::*;
-use model::event::{Event, GatewayEvent};
-use model::gateway::Game;
-use model::id::GuildId;
-use model::user::OnlineStatus;
+use model::{
+ event::{Event, GatewayEvent},
+ gateway::Game,
+ id::GuildId,
+ user::OnlineStatus
+};
use parking_lot::Mutex;
-use std::sync::Arc;
-use std::time::{Duration as StdDuration, Instant};
+use std::{
+ sync::Arc,
+ time::{Duration as StdDuration, Instant}
+};
use super::{
ConnectionStage,
CurrentPresence,
@@ -16,10 +20,12 @@ use super::{
WsClient,
WebSocketGatewayClientExt,
};
-use websocket::client::Url;
-use websocket::stream::sync::AsTcpStream;
-use websocket::sync::client::ClientBuilder;
-use websocket::WebSocketError;
+use websocket::{
+ client::Url,
+ stream::sync::AsTcpStream,
+ sync::client::ClientBuilder,
+ WebSocketError
+};
/// A Shard is a higher-level handler for a websocket connection to Discord's
/// gateway. The shard allows for sending and receiving messages over the