RustRover
 
Get RustRover

Rust REPL console

Last modified: 23 January 2025

REPL console is an interactive read-eval-print-loop environment for prototyping and testing your Rust code. This handy tool is a notebook, a calculator, and a Rust interpreter all in one.

Implemented on top of the evcxr_repl utility, Rust REPL provides syntax highlighting and completion for the code lines you type. It also shows a pane with the list of variables, functions, and structures currently in use.

You can access the REPL console from the context menu (Rust | Rust REPL), run it from the main menu (Tools | Rust | Rust REPL), or look it up in the Search Everywhere dialog (double Shift).

REPL in the Search Everywhere dialog

Find below an example of how the REPL console can be used to draft a simple program in Rust:

https://resources.jetbrains.com/help/img/idea/2024.3/rust_repl_example.png
Gif

The REPL console has the following controls:

  • Rerun – click to terminate the current REPL session and restart the console.

  • Execute Current Statement in One-Line Console – click to run the code you have written in the REPL console.

    tip

    Alternatively, press CtrlEnter to execute code immediately after completing the line.

  • Stop Rust REPL – click to stop Rust REPL.

  • Close – click to close the REPL console.

  • Soft-Wrap – click to create soft wraps in the message text.

  • Scroll to End – click to scroll to the end of displayed messages.

  • Print – click to print console text.

  • Browse Query History – click to view the history of entered queries.

  • Show Variables – click enable or disable the variables panel.