Trait api_request_utils_rs::dns::Resolve
source · pub trait Resolve: Send + Sync {
// Required method
fn resolve(
&self,
name: Name
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = SocketAddr> + Send, Global>, Box<dyn Error + Send + Sync, Global>>> + Send, Global>>;
}
Expand description
Trait for customizing DNS resolution in reqwest.
Required Methods§
sourcefn resolve(
&self,
name: Name
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = SocketAddr> + Send, Global>, Box<dyn Error + Send + Sync, Global>>> + Send, Global>>
fn resolve( &self, name: Name ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = SocketAddr> + Send, Global>, Box<dyn Error + Send + Sync, Global>>> + Send, Global>>
Performs DNS resolution on a Name
.
The return type is a future containing an iterator of SocketAddr
.
It differs from tower_service::Service<Name>
in several ways:
- It is assumed that
resolve
will always be ready to poll. - It does not need a mutable reference to
self
. - Since trait objects cannot make use of associated types, it requires
wrapping the returned
Future
and its containedIterator
withBox
.