1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use super::*;
use crate::service;
use futures::Future;
use std::io::Error;
use std::net::SocketAddr;
use tokio_core::reactor::Handle;
pub fn connect(
handle: &Handle,
socket_addr: SocketAddr,
) -> impl Future<Item = Context, Error = Error> {
connect_slave(handle, socket_addr, Slave::tcp_device())
}
pub fn connect_slave(
handle: &Handle,
socket_addr: SocketAddr,
slave: Slave,
) -> impl Future<Item = Context, Error = Error> {
service::tcp::connect_slave(handle, socket_addr, slave).map(|context| Context {
client: Box::new(context),
})
}