Skip to main content

AddressCandidates

Trait AddressCandidates 

pub trait AddressCandidates:
    Send
    + Sync
    + 'static {
    // Required method
    fn stream<'a>(
        &'a self,
        extensions: &'a Extensions,
    ) -> Pin<Box<dyn Stream<Item = Result<SocketAddr, Box<dyn Error + Send + Sync>>> + Send + 'a>>;
}
Available on crate feature net only.
Expand description

A lazily-resolved source of connection target SocketAddresses.

This is the abstraction boundary between resolving a target and connecting to it. An upstream connector (e.g. the rama-dns address resolver) stamps a ConnectorTargetStream into the Extensions, and a transport connector consumes it: dialing (and optionally racing) the yielded addresses. The transport stays resolver-agnostic: it only ever sees a stream of SocketAddrs, never a DNS resolver.

Required Methods§

fn stream<'a>( &'a self, extensions: &'a Extensions, ) -> Pin<Box<dyn Stream<Item = Result<SocketAddr, Box<dyn Error + Send + Sync>>> + Send + 'a>>

Stream the candidate SocketAddresses, in the order they should be attempted. The given Extensions carry per-request resolve config.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§