Trait Io

Source
pub trait Io<T>: Sized + Unpin {
    // Required method
    fn connect(
        initializer: T,
    ) -> impl Future<Output = Result<Self, Error>> + 'static + Send;

    // Provided method
    fn reconnect(
        initializer: T,
    ) -> impl Future<Output = Result<Self, Error>> + 'static + Send { ... }
}
Expand description

Represents an I/O source capable of reconnecting

This trait is implemented for a number of types in the library, with the implementations placed behind feature flags

Required Methods§

Source

fn connect( initializer: T, ) -> impl Future<Output = Result<Self, Error>> + 'static + Send

Initializes the connection to the I/O source

Provided Methods§

Source

fn reconnect( initializer: T, ) -> impl Future<Output = Result<Self, Error>> + 'static + Send

Re-establishes the connection to the I/O source

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> Io<T> for TcpStream
where T: 'static + ToSocketAddrs + Clone + Send + Sync,

Source§

async fn connect(initializer: T) -> Result<Self, Error>

Source§

impl<T> Io<T> for UnixStream
where T: 'static + AsRef<Path> + Clone + Send + Sync,

Source§

async fn connect(initializer: T) -> Result<Self, Error>

Implementors§