Skip to main content

ConnFactory

Trait ConnFactory 

Source
pub trait ConnFactory<C>:
    Send
    + Sync
    + 'static {
    // Required method
    fn connect(&self) -> ConnFuture<C>;
}
Expand description

Factory that produces a fresh connection on demand.

The factory is invoked from the pool whenever a slot needs a new connection. Implementations typically wrap a target address and produce TCP or QUIC connections; tests inject failure-injecting factories.

Required Methods§

Source

fn connect(&self) -> ConnFuture<C>

Build a fresh connection.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<C, F, Fut> ConnFactory<C> for F
where F: Fn() -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<C, NetError>> + Send + 'static,