mirror of
https://github.com/OMGeeky/tarpc.git
synced 2026-01-03 09:58:21 +01:00
Merge branch 'rustfmt-cfg' into 'master'
Add rustfmt.toml for reordering imports See merge request !10
This commit is contained in:
1
tarpc/rustfmt.toml
Normal file
1
tarpc/rustfmt.toml
Normal file
@@ -0,0 +1 @@
|
||||
reorder_imports = true
|
||||
@@ -15,9 +15,9 @@ use std::convert;
|
||||
use std::collections::HashMap;
|
||||
use std::marker::PhantomData;
|
||||
use std::mem;
|
||||
use std::net::{TcpListener, TcpStream, SocketAddr, ToSocketAddrs};
|
||||
use std::net::{SocketAddr, TcpListener, TcpStream, ToSocketAddrs};
|
||||
use std::sync::{Arc, Condvar, Mutex};
|
||||
use std::sync::mpsc::{channel, Sender, TryRecvError};
|
||||
use std::sync::mpsc::{Sender, TryRecvError, channel};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::time::Duration;
|
||||
use std::thread::{self, JoinHandle};
|
||||
@@ -97,7 +97,9 @@ impl InflightRpcs {
|
||||
|
||||
}
|
||||
|
||||
struct ConnectionHandler<'a, S> where S: Serve {
|
||||
struct ConnectionHandler<'a, S>
|
||||
where S: Serve
|
||||
{
|
||||
read_stream: TcpStream,
|
||||
write_stream: Mutex<TcpStream>,
|
||||
shutdown: &'a AtomicBool,
|
||||
@@ -123,8 +125,7 @@ impl<'a, S> ConnectionHandler<'a, S> where S: Serve {
|
||||
bincode::serde::deserialize_from(read_stream, bincode::SizeLimit::Infinite)
|
||||
}
|
||||
|
||||
fn handle_conn(&mut self) -> Result<()>
|
||||
{
|
||||
fn handle_conn(&mut self) -> Result<()> {
|
||||
let ConnectionHandler {
|
||||
ref mut read_stream,
|
||||
ref write_stream,
|
||||
@@ -225,7 +226,10 @@ impl ServeHandle {
|
||||
}
|
||||
|
||||
/// Start
|
||||
pub fn serve_async<A, S>(addr: A, server: S, read_timeout: Option<Duration>) -> io::Result<ServeHandle>
|
||||
pub fn serve_async<A, S>(addr: A,
|
||||
server: S,
|
||||
read_timeout: Option<Duration>)
|
||||
-> io::Result<ServeHandle>
|
||||
where A: ToSocketAddrs,
|
||||
S: 'static + Serve
|
||||
{
|
||||
@@ -487,7 +491,7 @@ mod test {
|
||||
extern crate env_logger;
|
||||
|
||||
use super::{Client, Serve, serve_async};
|
||||
use std::sync::{Arc, Mutex, Barrier};
|
||||
use std::sync::{Arc, Barrier, Mutex};
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user