Type Alias stubborn_io::StubbornTcpStream

source ·
pub type StubbornTcpStream<A> = StubbornIo<TcpStream, A>;
Expand description

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();
};

Aliased Type§

struct StubbornTcpStream<A> { /* private fields */ }