Kayıtlar

Temmuz, 2023 tarihine ait yayınlar gösteriliyor

Best practices on setting up a new Rust project

Cargo tool has a `cargo new` or `cargo init` command, but is it the only step that you need to think about for your Rust project? Let's see the important extra steps of creating a Rust crate, step 43 will shock you. .gitignore and equivalents The `cargo new` command has a `--vcs` option, and supports: git, hg, pijul, or fossil. But if you forgot to pass that option, set up the ignore files for your chosen VCS. For binaries, you're supposed to exclude `target` directory, and for libraries, `target` directory and  the `Cargo.lock` file ( FAQ entry ). #.gitignore file contents # Build artifacts target/ # For library crates Cargo.lock Cargo.toml fields `cargo new` creates the Cargo.toml file with fields; name, version, and edition. But to be able to upload the crate to crates.io, you'll also need to provide a ` description ` and `license` (Or `license-file`) fields. The `license` field is a string, filled with your chosen license(s) from  https://spdx.org/licenses/ . If the lic