pub struct StubResolver { /* private fields */ }
resolv
only.Expand description
A DNS stub resolver.
This type collects all information making it possible to start DNS
queries. You can create a new resolver using the system’s configuration
using the new()
associate function or using your own configuration
with from_conf()
.
Stub resolver values can be cloned relatively cheaply as they keep all information behind an arc.
If you want to run a single query or lookup on a resolver synchronously,
you can do so simply by using the run()
or run_with_conf()
associated functions.
Implementations
sourceimpl StubResolver
impl StubResolver
sourceimpl StubResolver
impl StubResolver
pub async fn lookup_addr(&self, addr: IpAddr) -> Result<FoundAddrs<&Self>, Error>
pub async fn lookup_host(
&self,
qname: impl ToDname
) -> Result<FoundHosts<&Self>, Error>
pub async fn search_host(
&self,
qname: impl ToRelativeDname
) -> Result<FoundHosts<&Self>, Error>
pub async fn lookup_srv(
&self,
service: impl ToRelativeDname,
name: impl ToDname,
fallback_port: u16
) -> Result<Option<FoundSrvs>, SrvError>
sourceimpl StubResolver
impl StubResolver
sourcepub fn run<R, F>(op: F) -> R::Outputwhere
R: Future + Send + 'static,
R::Output: Send + 'static,
F: FnOnce(StubResolver) -> R + Send + 'static,
Available on crate feature resolv-sync
only.
pub fn run<R, F>(op: F) -> R::Outputwhere
R: Future + Send + 'static,
R::Output: Send + 'static,
F: FnOnce(StubResolver) -> R + Send + 'static,
resolv-sync
only.Synchronously perform a DNS operation atop a standard resolver.
This associated functions removes almost all boiler plate for the case that you want to perform some DNS operation, either a query or lookup, on a resolver using the system’s configuration and wait for the result.
The only argument is a closure taking a reference to a StubResolver
and returning a future. Whatever that future resolves to will be
returned.
sourcepub fn run_with_conf<R, F>(conf: ResolvConf, op: F) -> R::Outputwhere
R: Future + Send + 'static,
R::Output: Send + 'static,
F: FnOnce(StubResolver) -> R + Send + 'static,
Available on crate feature resolv-sync
only.
pub fn run_with_conf<R, F>(conf: ResolvConf, op: F) -> R::Outputwhere
R: Future + Send + 'static,
R::Output: Send + 'static,
F: FnOnce(StubResolver) -> R + Send + 'static,
resolv-sync
only.Synchronously perform a DNS operation atop a configured resolver.
This is like run()
but also takes a resolver configuration for
tailor-making your own resolver.
Trait Implementations
sourceimpl Clone for StubResolver
impl Clone for StubResolver
sourcefn clone(&self) -> StubResolver
fn clone(&self) -> StubResolver
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for StubResolver
impl Debug for StubResolver
sourceimpl Default for StubResolver
impl Default for StubResolver
sourceimpl<'a> Resolver for &'a StubResolver
impl<'a> Resolver for &'a StubResolver
sourceimpl<'a> SearchNames for &'a StubResolver
impl<'a> SearchNames for &'a StubResolver
Auto Trait Implementations
impl RefUnwindSafe for StubResolver
impl Send for StubResolver
impl Sync for StubResolver
impl Unpin for StubResolver
impl UnwindSafe for StubResolver
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
sourcefn octets_into(self) -> Result<Target, ShortBuf>
fn octets_into(self) -> Result<Target, ShortBuf>
Performs the conversion.