use std::net::SocketAddr;
use futures::{Future, IntoFuture};
pub trait Connect {
type Future: Future;
fn connect(&mut self, address: SocketAddr) -> Self::Future;
}
impl<T, F> Connect for T
where T: FnMut(SocketAddr) -> F,
F: IntoFuture,
{
type Future = <T::Output as IntoFuture>::Future;
fn connect(&mut self, address: SocketAddr) -> Self::Future {
(self)(address).into_future()
}
}