Cannot add `trust_dns` dependency in my project

i am trying to use trust_dns but keep getting following error:

user1@iMac dns % cargo check
    Updating index
   Compiling libc v0.2.71
   Compiling getrandom v0.1.14
    Checking cfg-if v0.1.10
   Compiling bitflags v1.2.1
    Checking unicode-width v0.1.8
    Checking ppv-lite86 v0.2.8
    Checking strsim v0.8.0
    Checking ansi_term v0.11.0
    Checking vec_map v0.8.2
    Checking textwrap v0.11.0
    Checking atty v0.2.14
    Checking clap v2.33.1
    Checking rand_core v0.5.1
    Checking rand_chacha v0.2.2
    Checking rand v0.7.3
    Checking dns v0.1.0 (/Users/user1/work/rust/dns)
error[E0433]: failed to resolve: use of undeclared type or module `trust_dns`
 --> src/
6 | use trust_dns::op::{Message, MessageType, OpCode, Query};
  |     ^^^^^^^^^ use of undeclared type or module `trust_dns`

here is my Cargo.toml

rand =  "0.7.3"
clap = "2.33.1"
version ="0.19.5"
default_features = false

thanks for help

The trust-dns crate does not define a library - it seems to be an application that can be run, not a library that a can be depended upon.

If I'm reading the source correctly, the trust-dns crate is located at, and the only thing it contains is a file with a main function at

The repository has a bunch of other crates as well, though - for instance, it looks like OpCode is defined in trust-dns-proto. Are you sure trust-dns is the what you should be using?

I am trying the following example and it uses trust-dns as library


Thanks for pointing at the source, look like there is a name change it
is now called trust-dns-client


1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.