RustRover 2024.1 Help

Building and running

RustRover provides many ways to build and run Rust code. All of them rely on Cargo commands. However, they address different needs and may be useful in different situations.

  • Build/run using the Cargo tool window. The Cargo tool window displays a list of all project members and targets:

    List of project targets in Cargo tool window

    You can run any target with a double click – RustRover will execute the appropriate Cargo command depending on the target type.

  • Build/run using context actions. To run/build a function or test from the editor, use the icon on the gutter opposite its name:

    Run from the gutter menu

    You can also build/run files and packages from Project view: simply right-click the item and select the necessary action.

  • Use a custom run/debug configuration. If you'd like to run a certain Cargo command with specific settings and parameters over and over again, we recommend creating a run/debug configuration and running it from the main toolbar:

    Run icon on the main toolbar

Building

Use one of the following options to build a target or the entire project:

  • Open the Run Anything dialog (press Ctrl twice) and enter the cargo build command.

    Running a cargo build command for Run Anything dialog
  • To build the entire project in just two clicks, select Build | Build Project from the main menu.

  • If you want to build using a specific configuration, select it in the switcher and click or press Ctrl+F9:

    Build icon on the main toolbar

Viewing build results

Once you trigger a build, RustRover will open the Build tool window (Build Output tab) displaying the build process and its results:

Build output tab

Use the buttons on the toolbar to stop or rerun the build:

Stopping build from the Build tool window

Running

Run with temporary configuration

To run a target quickly using a default setup, choose one of the following options:

  • Locate the program entry point. Click in the gutter and select Run:

    Run from the gutter menu
  • Open the Project view. Right-click the necessary module (or the project root), and select Run:

    Starting tests from the Project view
  • In the Cargo tool window (View | Tool Windows | Cargo), double-click the necessary target.

    Run target from Cargo tool window

The IDE will create a temporary run configuration – it's name will be displayed in the switcher.

Temporary configuration in switcher

You can save the temporary configuration as permanent for future use.

Run with permanent configuration

Before proceeding to the steps below, make sure you have created a permanent configuration or saved a temporary configuration as permanent.

  • In the configuration switcher, click next to the desired configuration.

    Selecting and running a configuration from the toolbar

    Alternatively, select the configuration and click on the toolbar.

  • Select Run | Run from the main menu or press Shift+F10.

Viewing run results

Once you run your code, the IDE will open the Run tool window where you can observe output, interact with the program, and control execution:

Run tab

Use the toolbar on the left to control execution, navigate through result, and organize the Run tab.

Rerunning build from the Run tool window

Debugging

To track errors that show up at runtime, you can run your application (or separate targets) in debug mode. For more information about debugging, refer to Debug code.

Last modified: 29 May 2024