async trait が使えるようになれば trait IsTcpStream: AsyncRead + AsyncWrite + ... { async fn connect(addr) -> io::Result<Self>; } と抽象化できそう
-
-
struct Async<T, Rt: rt::Runtime> { ... } impl Async<TcpStream, rt::Tokio> { async fn connect(addr: impl ToSocketAddrs) -> io::Result<Self> { ... } } impl Async<TcpStream, rt::AsyncStd> { async fn connect(addr: impl ToSocketAddrs) -> io::Result<Self> { ... } } …うーん
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.