Crate c_ares [] [src]

A safe wrapper for the c-ares library.

Usage is as follows:

  • Create a Channel, providing a callback which will be used to notify you when c-ares wants you to listen for read or write events on its behalf.

  • When this callback is invoked, do what it asks!

  • When a file descriptor becomes readable or writable, call process_fd() on the channel to tell c-ares what has happened.

  • c-ares doesn't create any threads of its own. So if you have queries pending and don't see events happening, you still need to call process_fd() at some point anyway - to give c-ares an opportunity to process any requests that have timed out.

  • Make queries on the channel. Queries all take callbacks, which will be called when the query completes.

This model is a good fit for an event loop - as provided by mio, for example.

Complete examples showing how to use the library can be found here.

Modules

flags

Structs

AAAAResult

The contents of a single AAAA record.

AAAAResults

The result of a successful AAAA lookup.

AResult

The contents of a single A record.

AResults

The result of a successful A lookup.

CNameResult

The result of a successful CNAME lookup.

Channel

A channel for name service lookups.

MXResult

The contents of a single MX record.

MXResults

The result of a successful MX lookup.

NAPTRResult

The contents of a single NAPTR record.

NAPTRResults

The result of a successful NAPTR lookup.

NSResult

The contents of a single NS record.

NSResults

The result of a successful NS lookup.

Options

Used to configure the behaviour of the name resolver.

PTRResult

The contents of a single PTR record.

PTRResults

The result of a successful PTR lookup.

SOAResult

The result of a successful SOA lookup.

SRVResult

The contents of a single SRV record.

SRVResults

The result of a successful SRV lookup.

TXTResult

The contents of a single TXT record.

TXTResults

The result of a successful TXT lookup.

Enums

AresError

Error codes that the library might return. Use str_error() to convert an error code into a description.

Constants

INVALID_FD

An invalid file descriptor. Use this to represent 'no action' when calling process_fd() on a channel.

Functions

str_error

Returns the description of an AresError.