Skip to main content

HostResolver

Trait HostResolver 

Source
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§

Source

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§

Source

fn set_ttlp(hostname: &str) -> Option<i32>

Optionally sets the “Time to Live Pointer” for the given hostname’s NSS query. This field determines cache lifespan for DNS entries.

Returning None will skip writing to this pointer entirely.

This function is only invoked if the caller’s TTLP is not null.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§