mirror of
https://github.com/OMGeeky/tarpc.git
synced 2026-02-23 15:49:54 +01:00
Make Tcp* default types
This commit is contained in:
@@ -386,7 +386,8 @@ macro_rules! service_inner {
|
|||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
#[doc="The client stub that makes RPC calls to the server."]
|
#[doc="The client stub that makes RPC calls to the server."]
|
||||||
pub struct Client<S: $crate::Stream>($crate::protocol::Client<__Request, __Reply, S>);
|
pub struct Client<S = ::std::net::TcpStream>($crate::protocol::Client<__Request, __Reply, S>)
|
||||||
|
where S: $crate::Stream;
|
||||||
|
|
||||||
impl Client<::std::net::TcpStream> {
|
impl Client<::std::net::TcpStream> {
|
||||||
pub fn new<A>(addr: A) -> $crate::Result<Self>
|
pub fn new<A>(addr: A) -> $crate::Result<Self>
|
||||||
@@ -396,7 +397,9 @@ macro_rules! service_inner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: $crate::Stream> Client<S> {
|
impl<S> Client<S>
|
||||||
|
where S: $crate::Stream
|
||||||
|
{
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
#[doc="Create a new client with default configuration that connects to the given \
|
#[doc="Create a new client with default configuration that connects to the given \
|
||||||
address."]
|
address."]
|
||||||
@@ -427,7 +430,8 @@ macro_rules! service_inner {
|
|||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
#[doc="The client stub that makes asynchronous RPC calls to the server."]
|
#[doc="The client stub that makes asynchronous RPC calls to the server."]
|
||||||
pub struct AsyncClient<S: $crate::Stream>($crate::protocol::Client<__Request, __Reply, S>);
|
pub struct AsyncClient<S = ::std::net::TcpStream>($crate::protocol::Client<__Request, __Reply, S>)
|
||||||
|
where S: $crate::Stream;
|
||||||
|
|
||||||
impl AsyncClient<::std::net::TcpStream> {
|
impl AsyncClient<::std::net::TcpStream> {
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
@@ -440,7 +444,8 @@ macro_rules! service_inner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: $crate::Stream> AsyncClient<S> {
|
impl<S> AsyncClient<S>
|
||||||
|
where S: $crate::Stream {
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
#[doc="Create a new asynchronous client that connects to the given address."]
|
#[doc="Create a new asynchronous client that connects to the given address."]
|
||||||
pub fn with_config<D>(dialer: D, config: $crate::Config) -> $crate::Result<Self>
|
pub fn with_config<D>(dialer: D, config: $crate::Config) -> $crate::Result<Self>
|
||||||
@@ -466,7 +471,8 @@ macro_rules! service_inner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
struct __Server<S: 'static + Service>(S);
|
struct __Server<S>(S)
|
||||||
|
where S: 'static + Service;
|
||||||
|
|
||||||
impl<S> $crate::protocol::Serve for __Server<S>
|
impl<S> $crate::protocol::Serve for __Server<S>
|
||||||
where S: 'static + Service
|
where S: 'static + Service
|
||||||
|
|||||||
@@ -153,7 +153,8 @@ pub trait TcpDialerExt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Connects to a socket address.
|
/// Connects to a socket address.
|
||||||
pub struct TcpDialer<A: ToSocketAddrs>(pub A);
|
pub struct TcpDialer<A = SocketAddr>(pub A)
|
||||||
|
where A: ToSocketAddrs;
|
||||||
impl<A: ToSocketAddrs> Dialer for TcpDialer<A> {
|
impl<A: ToSocketAddrs> Dialer for TcpDialer<A> {
|
||||||
type Stream = TcpStream;
|
type Stream = TcpStream;
|
||||||
fn dial(&self) -> io::Result<TcpStream> {
|
fn dial(&self) -> io::Result<TcpStream> {
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ impl<'a, S, St> ConnectionHandler<'a, S, St>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Provides methods for blocking until the server completes,
|
/// Provides methods for blocking until the server completes,
|
||||||
pub struct ServeHandle<D>
|
pub struct ServeHandle<D = TcpDialer>
|
||||||
where D: Dialer
|
where D: Dialer
|
||||||
{
|
{
|
||||||
tx: Sender<()>,
|
tx: Sender<()>,
|
||||||
|
|||||||
Reference in New Issue
Block a user