Import restructuring
Use new grouping syntax from Rust 1.25 Group `use` in following order: std, external, internal
This commit is contained in:
parent
94fd95d516
commit
1e3e9485df
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
mod base;
|
||||
|
||||
#[cfg(unix)]
|
||||
mod unix;
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
19
src/error.rs
19
src/error.rs
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use super::Payload;
|
||||
use utils::nonce;
|
||||
|
||||
|
||||
#[derive(Debug, Default, Serialize)]
|
||||
pub struct Command<T>
|
||||
where T: Serialize
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use super::Payload;
|
||||
use utils::nonce;
|
||||
|
||||
|
||||
#[derive(Debug, Default, Serialize)]
|
||||
pub struct Handshake {
|
||||
nonce: String,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use models::Command;
|
||||
use utils::pid;
|
||||
|
||||
|
||||
#[derive(Debug, Default, Serialize)]
|
||||
pub struct SetActivityArgs {
|
||||
pid: i32,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use libc::getpid;
|
||||
use uuid::Uuid;
|
||||
|
||||
|
||||
pub fn pid() -> i32 {
|
||||
unsafe { getpid() as i32 }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue