Trait stream_reconnect::UnderlyingStream[][src]

pub trait UnderlyingStream<C, I, E>: Sized + Unpin where
    C: Clone + Send + Unpin,
    E: Error
{ fn establish(
        ctor_arg: C
    ) -> Pin<Box<dyn Future<Output = Result<Self, E>> + Send>>;
fn is_write_disconnect_error(&self, err: &E) -> bool;
fn exhaust_err() -> E; fn is_read_disconnect_error(&self, item: &I) -> bool { ... } }
Expand description

Trait that should be implemented for an [Stream] and/or [Sink] item to enable it to work with the ReconnectStream struct.

Required methods

The creation function is used by ReconnectStream in order to establish both the initial IO connection in addition to performing reconnects.

When sink send experience an Error during operation, it does not necessarily mean it is a disconnect/termination (ex: WouldBlock). You may specify which errors are considered “disconnects” by this method.

This is returned when retry quota exhausted.

Provided methods

It’s common practice for [Stream] implementations that return an Err when there’s an error. You may match the result to tell them apart from normal response. By default, no response is considered a “disconnect”.

Implementors