pub trait HostResolver {
// Required method
fn resolve_host(
hostname: &str,
) -> Result<impl IntoIterator<Item = Addr>, NssErr>;
// Provided method
fn set_ttlp(hostname: &str) -> Option<i32> { ... }
}Expand description
Implement this trait with the actual address business logic
that gethostbyname4_r should expose. The C interop layer
simply wraps the resolution defined here.
Required Methods§
Sourcefn resolve_host(
hostname: &str,
) -> Result<impl IntoIterator<Item = Addr>, NssErr>
fn resolve_host( hostname: &str, ) -> Result<impl IntoIterator<Item = Addr>, NssErr>
Returns zero or more host addresses matching the hostname query or an NSS-contextualized error on failure.
Provided Methods§
Sourcefn set_ttlp(hostname: &str) -> Option<i32>
fn set_ttlp(hostname: &str) -> Option<i32>
Optionally sets the “Time to Live Pointer” for the given hostname’s NSS result. This influences address cache lifespan.
It is perfectly fine to ignore this. Only implement it if you have a reason.
This function is only invoked if the caller’s TTLP is not null, and returning None will skip writing to the pointer entirely.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".