aboutsummaryrefslogtreecommitdiff
path: root/src/voice
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-11-11 10:05:33 -0800
committerZeyla Hellyer <[email protected]>2017-11-11 10:05:33 -0800
commit348d52b50780109a77a5223d2ede8e0b9a490cfd (patch)
tree1049f8ab6be8f9b22ec69a3746ae37a90c6f6a62 /src/voice
parentSimplify Error's `Display` impl (diff)
downloadserenity-348d52b50780109a77a5223d2ede8e0b9a490cfd.tar.xz
serenity-348d52b50780109a77a5223d2ede8e0b9a490cfd.zip
Re-order use statements alphabetically
Diffstat (limited to 'src/voice')
-rw-r--r--src/voice/connection.rs12
-rw-r--r--src/voice/error.rs8
-rw-r--r--src/voice/handler.rs8
-rw-r--r--src/voice/manager.rs2
-rw-r--r--src/voice/payload.rs2
-rw-r--r--src/voice/streamer.rs7
-rw-r--r--src/voice/threading.rs4
7 files changed, 20 insertions, 23 deletions
diff --git a/src/voice/connection.rs b/src/voice/connection.rs
index e507f41..12c7eee 100644
--- a/src/voice/connection.rs
+++ b/src/voice/connection.rs
@@ -1,5 +1,9 @@
use byteorder::{BigEndian, LittleEndian, ReadBytesExt, WriteBytesExt};
-use parking_lot::Mutex;
+use internal::prelude::*;
+use internal::ws_impl::{ReceiverExt, SenderExt};
+use internal::Timer;
+use model::event::VoiceEvent;
+use model::UserId;
use opus::{
packet as opus_packet,
Application as CodingMode,
@@ -7,6 +11,7 @@ use opus::{
Decoder as OpusDecoder,
Encoder as OpusEncoder,
};
+use parking_lot::Mutex;
use sodiumoxide::crypto::secretbox::{self, Key, Nonce};
use std::collections::HashMap;
use std::io::Write;
@@ -22,11 +27,6 @@ use websocket::client::Url as WebsocketUrl;
use websocket::sync::client::ClientBuilder;
use websocket::sync::stream::{AsTcpStream, TcpStream, TlsStream};
use websocket::sync::Client as WsClient;
-use internal::prelude::*;
-use internal::ws_impl::{ReceiverExt, SenderExt};
-use internal::Timer;
-use model::event::VoiceEvent;
-use model::UserId;
type Client = WsClient<TlsStream<TcpStream>>;
diff --git a/src/voice/error.rs b/src/voice/error.rs
index d402e54..b3a8194 100644
--- a/src/voice/error.rs
+++ b/src/voice/error.rs
@@ -1,6 +1,6 @@
-use serde_json::{self, Value};
+use serde_json::{Error as JsonError, Value};
+use std::io::Error as IoError;
use std::process::Output;
-use std;
/// An error returned from the voice module.
// Errors which are not visible to the end user are hidden.
@@ -31,8 +31,8 @@ pub enum VoiceError {
/// An error returned from the dca method.
#[derive(Debug)]
pub enum DcaError {
- IoError(std::io::Error),
+ IoError(IoError),
InvalidHeader,
- InvalidMetadata(serde_json::Error),
+ InvalidMetadata(JsonError),
InvalidSize(i32),
}
diff --git a/src/voice/handler.rs b/src/voice/handler.rs
index e09c292..d1ef93e 100644
--- a/src/voice/handler.rs
+++ b/src/voice/handler.rs
@@ -1,11 +1,9 @@
+use constants::VoiceOpCode;
+use model::{ChannelId, GuildId, UserId, VoiceState};
use serde_json::Value;
use std::sync::mpsc::{self, Sender as MpscSender};
-use super::{AudioReceiver, AudioSource};
use super::connection_info::ConnectionInfo;
-use super::Status as VoiceStatus;
-use constants::VoiceOpCode;
-use model::{ChannelId, GuildId, UserId, VoiceState};
-use super::threading;
+use super::{AudioReceiver, AudioSource, Status as VoiceStatus, threading};
/// The handler is responsible for "handling" a single voice connection, acting
/// as a clean API above the inner connection.
diff --git a/src/voice/manager.rs b/src/voice/manager.rs
index 34d2a40..ffe9bbb 100644
--- a/src/voice/manager.rs
+++ b/src/voice/manager.rs
@@ -1,8 +1,8 @@
+use model::{ChannelId, GuildId, UserId};
use serde_json::Value;
use std::collections::HashMap;
use std::sync::mpsc::Sender as MpscSender;
use super::Handler;
-use model::{ChannelId, GuildId, UserId};
/// A manager is a struct responsible for managing [`Handler`]s which belong to
/// a single [`Shard`]. This is a fairly complex key-value store,
diff --git a/src/voice/payload.rs b/src/voice/payload.rs
index 0096ebe..cef19cd 100644
--- a/src/voice/payload.rs
+++ b/src/voice/payload.rs
@@ -1,6 +1,6 @@
+use constants::VoiceOpCode;
use serde_json::Value;
use super::connection_info::ConnectionInfo;
-use constants::VoiceOpCode;
#[inline]
pub fn build_identify(info: &ConnectionInfo) -> Value {
diff --git a/src/voice/streamer.rs b/src/voice/streamer.rs
index 4702bdb..99be4de 100644
--- a/src/voice/streamer.rs
+++ b/src/voice/streamer.rs
@@ -1,13 +1,12 @@
use byteorder::{LittleEndian, ReadBytesExt};
+use internal::prelude::*;
use serde_json;
use std::ffi::OsStr;
+use std::fs::File;
use std::io::{BufReader, ErrorKind as IoErrorKind, Read, Result as IoResult};
use std::process::{Child, Command, Stdio};
-use super::{AudioSource, AudioType, DcaError, DcaMetadata, VoiceError};
-use internal::prelude::*;
-
-use std::fs::File;
use std::result::Result as StdResult;
+use super::{AudioSource, AudioType, DcaError, DcaMetadata, VoiceError};
struct ChildContainer(Child);
diff --git a/src/voice/threading.rs b/src/voice/threading.rs
index fc3a947..931fc91 100644
--- a/src/voice/threading.rs
+++ b/src/voice/threading.rs
@@ -1,9 +1,9 @@
+use internal::Timer;
+use model::GuildId;
use std::sync::mpsc::{Receiver as MpscReceiver, TryRecvError};
use std::thread::Builder as ThreadBuilder;
use super::connection::Connection;
use super::Status;
-use internal::Timer;
-use model::GuildId;
pub(crate) fn start(guild_id: GuildId, rx: MpscReceiver<Status>) {
let name = format!("Serenity Voice (G{})", guild_id);