mirror of
https://github.com/OMGeeky/tarpc.git
synced 2026-02-23 15:49:54 +01:00
impl From<S> for bincode::Transport<S>
This commit is contained in:
@@ -118,12 +118,18 @@ where
|
|||||||
Item: for<'de> Deserialize<'de>,
|
Item: for<'de> Deserialize<'de>,
|
||||||
SinkItem: Serialize,
|
SinkItem: Serialize,
|
||||||
{
|
{
|
||||||
Transport {
|
Transport::from(io)
|
||||||
inner: Compat::new(AsyncBincodeStream::from(io).for_async()),
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<S, Item, SinkItem> From<S> for Transport<S, Item, SinkItem> {
|
||||||
|
fn from(inner: S) -> Self {
|
||||||
|
Transport {
|
||||||
|
inner: Compat::new(AsyncBincodeStream::from(inner).for_async()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Connects to `addr`, wrapping the connection in a bincode transport.
|
/// Connects to `addr`, wrapping the connection in a bincode transport.
|
||||||
pub async fn connect<Item, SinkItem>(addr: &SocketAddr) -> io::Result<Transport<TcpStream, Item, SinkItem>>
|
pub async fn connect<Item, SinkItem>(addr: &SocketAddr) -> io::Result<Transport<TcpStream, Item, SinkItem>>
|
||||||
where
|
where
|
||||||
|
|||||||
Reference in New Issue
Block a user