pub struct DnsCache { /* private fields */ }
Expand description
DNS cache for resolving hostnames to IP addresses
Implementations§
Source§impl DnsCache
impl DnsCache
Sourcepub async fn resolve(
&self,
hostname: &str,
port: u16,
) -> Result<Vec<SocketAddr>>
pub async fn resolve( &self, hostname: &str, port: u16, ) -> Result<Vec<SocketAddr>>
Resolve a hostname, using cache if available Resolve hostname and port to socket addresses with caching
§Errors
Returns an error if DNS resolution fails
Sourcepub async fn remove_expired(&self)
pub async fn remove_expired(&self)
Remove expired entries from the cache
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DnsCache
impl !RefUnwindSafe for DnsCache
impl Send for DnsCache
impl Sync for DnsCache
impl Unpin for DnsCache
impl !UnwindSafe for DnsCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more