mirror of
https://github.com/OMGeeky/tarpc.git
synced 2026-02-23 15:49:54 +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::collections::HashMap;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::mem;
|
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::{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::sync::atomic::{AtomicBool, Ordering};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std::thread::{self, JoinHandle};
|
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,
|
read_stream: TcpStream,
|
||||||
write_stream: Mutex<TcpStream>,
|
write_stream: Mutex<TcpStream>,
|
||||||
shutdown: &'a AtomicBool,
|
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)
|
bincode::serde::deserialize_from(read_stream, bincode::SizeLimit::Infinite)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_conn(&mut self) -> Result<()>
|
fn handle_conn(&mut self) -> Result<()> {
|
||||||
{
|
|
||||||
let ConnectionHandler {
|
let ConnectionHandler {
|
||||||
ref mut read_stream,
|
ref mut read_stream,
|
||||||
ref write_stream,
|
ref write_stream,
|
||||||
@@ -225,7 +226,10 @@ impl ServeHandle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Start
|
/// 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,
|
where A: ToSocketAddrs,
|
||||||
S: 'static + Serve
|
S: 'static + Serve
|
||||||
{
|
{
|
||||||
@@ -487,7 +491,7 @@ mod test {
|
|||||||
extern crate env_logger;
|
extern crate env_logger;
|
||||||
|
|
||||||
use super::{Client, Serve, serve_async};
|
use super::{Client, Serve, serve_async};
|
||||||
use std::sync::{Arc, Mutex, Barrier};
|
use std::sync::{Arc, Barrier, Mutex};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user