Should Cargo.lock be committed when the crate is both a rust library and an executable?

Yes, crates that depend on your library will ignore your Cargo.lock. The Cargo FAQ provides more details: Why do binaries have Cargo.lock in version control, but not libraries? The purpose of a Cargo.lock is to describe the state of the world at the time of a successful build. It is then used to provide deterministic … Read more

Rust can’t find crate

To add to the given answers, a library compiled as a cdylib (docs) can generate this error when you try to reference it in another project. I solved it by separating the code I wished to reuse in a regular lib project.

Error installing a crate via cargo: specified package has no binaries

cargo install is used to install binary packages that happen to be distributed through crates.io. If you want to use a crate as a dependency, add it to your Cargo.toml. Read the Rust getting started guide and the Cargo getting started guide for further information. In short: cargo new my_project cd my_project echo ‘curl = … Read more

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.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)