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 result of a successful lookup for an AAAA record.

AResult

The result of a successful lookup for an A record.

CNameResult

The result of a successful lookup for a CNAME record.

Channel

A channel for name service lookups.

Options

Used to configure the behaviour of the name resolver.

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

Get the description of an AresError.