Cargo run/debug configuration
To create a Cargo run/debug configuration, do the following:
Create a Cargo configuration
Go to
.To create a new configuration, click
(or press Alt+Insert) and select Cargo:
Specify the configuration Name. This name will appear in the list of available run/debug configurations.
Specify the preferred configuration settings:
Settings field
Description
Allow multiple instances
Enable this option if you want to allow multiple instances of the configuration to run simultaneously. Otherwise, re-running the configuration will terminate the active session.
Store as project file
Enable this option to save your configuration as a project file and share it with team members through VCS.
Command
Use the following pattern when specifying the command:
[command] [build options] [--] [program arguments]The
--
prefix followed by an extra space separates Cargo build options from input arguments.Channel
Optionally, specify the preferred channel. It will only affect the current configuration.
Automatically add required features if possible
This option adds
--features="feature_name"
for allrequired-features
listed in relevant Cargo.toml files. The option is enabled by default.Use all features in tests
This option adds the
--all-features
flag if you are running acargo test
command. For other commands, this option is ignored.Emulate terminal in output console
This option can be useful for crates like color-backtrace, which behave differently when a process is run under TTY (refer to the feature description). This option is not available on Windows.
Run with root privileges / Run with Administrator privileges
Enable this option to debug your application as root.
When launching a debug session with root privileges for the first time, you will be prompted whether you want to re-authorize each time you begin debugging or grant authorization for a fixed time period.
Environment variables
Optionally, specify environment variables (overriding or custom). Format them as key-value pairs separated with semicolons, for example:
HOME=/home/me.user;MY_APP_DATA=/home/me.user/appdataWorking directory
If needed, change the directory used by the running task.
Redirect input from
This option allows you to take program input from a file instead of the console.
Backtrace
This option sets the
RUST_BACKTRACE
environment variable, which prints the unwound stack trace into error messages and controls its length. For more information, refer to Debugging Rust code in CLion: More debug features.Before launch
Here you can specify the steps to execute before launch. By default, the Build step is included, which means the IDE will rebuild your sources on every run.
Show this page
Enable this option to always show the run/debug configuration settings prior to actually starting it.
Activate tool window
Use this option to specify whether or not the Run/Debug tool window opens when you start the run/debug configuration.
Click OK to save the configuration.