[][src]Type Definition stubborn_io::StubbornTcpStream

type StubbornTcpStream<A> = StubbornIo<TcpStream, A>;

A drop in replacement for tokio's TcpStream, with the distinction that it will automatically attempt to reconnect in the face of connectivity failures.

use stubborn_io::StubbornTcpStream;
use tokio::io::AsyncWriteExt;

let addr = "localhost:8080";

async {
    let mut tcp_stream = StubbornTcpStream::connect(addr).await.unwrap();
    tcp_stream.write_all(b"hello world!").await.unwrap();
};