Import restructuring

Use new grouping syntax from Rust 1.25
Group `use` in following order:
std, external, internal
This commit is contained in:
Patrick Auernig 2018-03-29 23:40:56 +02:00
parent 94fd95d516
commit 1e3e9485df
12 changed files with 42 additions and 22 deletions

View File

@ -1,8 +1,9 @@
use std::io::Result;
use connection::Connection;
use models::{Handshake, OpCode};
#[cfg(feature = "rich_presence")]
use rich_presence::{SetActivityArgs, SetActivity};
use error::Result;
#[derive(Debug)]
pub struct Client<T>

View File

@ -1,7 +1,11 @@
use std::io::Result;
use std::marker::Sized;
use std::fmt::Debug;
use std::{
marker::Sized,
fmt::Debug
};
use models::{Payload, OpCode};
use error::Result;
pub trait Connection
where Self: Sized

View File

@ -1,5 +1,4 @@
mod base;
#[cfg(unix)]
mod unix;

View File

@ -1,13 +1,16 @@
use std::os::unix::net::UnixStream;
use std::io::{Write, Read, Result};
use std::time;
use std::path::PathBuf;
use std::env;
use std::fmt::Debug;
use models::Payload;
use std::{
os::unix::net::UnixStream,
io::{Write, Read},
time,
path::PathBuf,
env,
fmt::Debug
};
use models::{Message, OpCode};
use super::base::Connection;
use models::{Payload, Message, OpCode};
use error::Result;
pub struct UnixConnection {
socket: UnixStream,

View File

@ -1,7 +1,14 @@
use std::error::Error as StdError;
use std::result::Result as StdResult;
use std::io::Error as IoError;
use std::fmt;
use std::{
error::Error as StdError,
io::Error as IoError,
result::Result as StdResult,
fmt::{
self,
Display,
Formatter
}
};
#[derive(Debug)]
pub enum Error {
@ -9,8 +16,8 @@ pub enum Error {
Conversion,
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
impl Display for Error {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
f.write_str(self.description())
}
}

View File

@ -10,7 +10,6 @@ extern crate libc;
#[macro_use]
mod macros;
mod error;
mod utils;
mod connection;
@ -20,9 +19,7 @@ mod rich_presence;
pub mod client;
pub use client::Client;
#[cfg(feature = "rich_presence")]
pub use rich_presence::*;
#[cfg(unix)]
pub use connection::UnixConnection;

View File

@ -1,7 +1,9 @@
use serde::Serialize;
use super::Payload;
use utils::nonce;
#[derive(Debug, Default, Serialize)]
pub struct Command<T>
where T: Serialize

View File

@ -1,6 +1,7 @@
use super::Payload;
use utils::nonce;
#[derive(Debug, Default, Serialize)]
pub struct Handshake {
nonce: String,

View File

@ -1,9 +1,12 @@
use std::io::{self, Write, Read};
use byteorder::{WriteBytesExt, ReadBytesExt, LittleEndian};
use serde_json;
use serde::Serialize;
use error::{Result, Error};
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum OpCode {
Handshake,

View File

@ -3,6 +3,7 @@ mod command;
mod handshake;
use serde::Serialize;
pub use self::message::{Message, OpCode};
pub use self::command::Command;
pub use self::handshake::Handshake;

View File

@ -1,6 +1,7 @@
use models::Command;
use utils::pid;
#[derive(Debug, Default, Serialize)]
pub struct SetActivityArgs {
pid: i32,

View File

@ -1,6 +1,7 @@
use libc::getpid;
use uuid::Uuid;
pub fn pid() -> i32 {
unsafe { getpid() as i32 }
}