# Features Once [enabled](usage.md) in an **`nmk`** project, the **`nmk-rust`** plugin provides the following features. ## Check for cargo install The **`nmk-rust`** plugin contributes instructions so that the [**sys.deps**](https://nmk-base.readthedocs.io/en/stable/tasks.html#sys-deps-check-for-system-dependencies) task checks and tells how to install [**cargo**](https://doc.rust-lang.org/cargo/). ## VSCode support If the [nmk-vscode](https://nmk-vscode.readthedocs.io) plugin is also enabled in the project, following features are provided by **`nmk-rust`**. ### VSCode extensions Following extensions are [recommended](https://nmk-vscode.readthedocs.io/en/stable/extend.html#extensions) for rust development: * [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) -- generic rust support * [Even Better TOML](https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml) -- toml files support ## Files generation As part of the project [**`setup`**](https://nmk-base.readthedocs.io/en/stable/tasks.html#setup-task), following files will be generated by **`nmk-rust`**. ### Cargo configuration file The **`cargo`** [configuration file](https://doc.rust-lang.org/cargo/reference/config.html) is generated by the **{ref}`rust.config`** task. In addition to {ref}`files` and {ref}`items` that can be contributed by the project, **`nmk-rust`** generates the following items by default: * [**build.target-dir**](https://doc.rust-lang.org/cargo/reference/config.html#buildtarget-dir): set to **{ref}`${rustTargetFolder}`**\ (by convention all **`nmk`** projects should generate their files in [**${outputDir}**](https://nmk-base.readthedocs.io/en/stable/config.html#outputdir-output-base-directory)) ### Manifest file The **`cargo`** [manifest file](https://doc.rust-lang.org/cargo/reference/manifest.html) is generated by the **{ref}`rust.manifest`** task. In addition to {ref}`files` and {ref}`items` that can be contributed by the project, **`nmk-rust`** generates the following items by default: * [**package.name**](https://doc.rust-lang.org/cargo/reference/manifest.html#the-name-field): set to **{ref}`${rustPackage}`** * [**package.edition**](https://doc.rust-lang.org/cargo/reference/manifest.html#the-edition-field): set to **{ref}`${rustEdition}`** * [**package.authors**](https://doc.rust-lang.org/cargo/reference/manifest.html#the-authors-field): set to ["[**${projectAuthor}**](https://nmk-base.readthedocs.io/en/stable/config.html#projectauthor-project-author)"] ### Rustfmt configuration file The **`rustfmt`** [configuration file](https://rust-lang.github.io/rustfmt/) is generated by the **{ref}`rust.fmtcfg`** task. In addition to {ref}`files` and {ref}`items` that can be contributed by the project, **`nmk-rust`** generates the following items by default: * [**max_width**](https://rust-lang.github.io/rustfmt/?version=v1.6.0&search=#max_width): set to **{ref}`${rustLineLength}`**\ (by convention all **`nmk`** projects source code files should allow 160 characters wide lines) ## Code format As part of the project [**`build`**](https://nmk-base.readthedocs.io/en/stable/tasks.html#build-task), **`nmk-rust`** will call **`cargo fmt`** command to format rust source code (this is handled by the **{ref}`rust.format`** task). If all project developers use VSCode IDE, this task shouldn't do anything since the code is already formatted by the [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) extension. However, this allows to make sure that the project code is always correctly formatted. Particularly in CI, if some code is committed without the correct format, this will cause the [**`git.dirty`**](https://nmk-base.readthedocs.io/en/stable/tasks.html#git-dirty-check-for-dirty-project-folder) task to fail the build.