This command will display a tree of dependencies to the terminal. An example
of a simple project that depends on the "rand" package:
myproject v0.1.0 (/myproject)
└── rand v0.7.3
├── getrandom v0.1.14
│ ├── cfg-if v0.1.10
│ └── libc v0.2.68
├── libc v0.2.68 (*)
├── rand_chacha v0.2.2
│ ├── ppv-lite86 v0.2.6
│ └── rand_core v0.5.1
│ └── getrandom v0.1.14 (*)
└── rand_core v0.5.1 (*)
[build-dependencies]
└── cc v1.0.50
Packages marked with (*)
have been "de-duplicated". The dependencies for the
package have already been shown elswhere in the graph, and so are not
repeated. Use the --no-dedupe
option to repeat the duplicates.
The -e
flag can be used to select the dependency kinds to display. The
"features" kind changes the output to display the features enabled by
each dependency. For example, cargo tree -e features
:
myproject v0.1.0 (/myproject)
└── log feature "serde"
└── log v0.4.8
├── serde v1.0.106
└── cfg-if feature "default"
└── cfg-if v0.1.10
In this tree, myproject
depends on log
with the serde
feature. log
in
turn depends on cfg-if
with "default" features. When using -e features
it
can be helpful to use -i
flag to show how the features flow into a package.
See the examples below for more detail.