How to use a local unpublished crate?

Add a dependency section to your executable’s Cargo.toml and specify the path:

[dependencies.my_lib]
path = "../my_lib"

or the equivalent alternate TOML:

[dependencies]
my_lib = { path = "../my_lib" }

Check out the Cargo docs for specifying dependencies for more detail, like how to use a git repository instead of a local path.

Leave a Comment