Question about dependency of dependency


I would like to know how can I use a dependency of a dependency without declaring it in Cargo.toml? Is it possible?


If the dependency exports it's dependency, you will be able to use it without importing it.
For example, If a dependency crate uses tokio and exports it by:

pub use tokio;

You will be able to use it by using use dependency::tokio;.

1 Like

Yes, that works. So it's like module, it needs to be exported otherwise it's private. Is that right?

1 Like

As far as I know, it's like a module

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.