Rust + CLion = Love

  • Tutorial


Hello, Habr! In general, as I promised, here is a story about how CLion as an IDE for Rust on MacOS is used. Why not IntelliJ IDEA? Because CLion can debut. Why LLDB and not GDB? Because LLDB was installed with Xcode. I like this IDE, and so I decided to tell you about it. If you are interested, then welcome to cat.

Rust Installation


Just execute the command in the terminal:

curl https://sh.rustup.rs -sSf | sh

and follow the instructions.

You can also install fmt - a utility for formatting and clippy - a utility for static code analysis. If supported by your operating system. They work for me on Windows and Ubuntu, but not on the Mac. Although maybe the situation has already changed.

rustup component add rustfmt

rustup component add clippy

Install LLDB


If you did not install Xcode, then run the command in the terminal

lldb

and follow the instructions.

CLion installation


Download on the official website. Link: Tyk . Well, as usual, follow the instructions.

Plugin installation


  1. Launch CLion and click on the Configure button


  2. Go to Plugins


  3. Install plugin



Toolchain setup


  1. Create a new project


  2. Add a standard library by clicking on the link or specifying the path to the installed


  3. Select LLDB as a debugger


  4. Choose your preferred settings for Rust



Adding configurations to run


  1. Click Add configuration


  2. Choose Cargo Command





Debugging


 
  1. Put a breakpoint and click on the button with a bug

  2. At the bottom you will see a window with a call stack and variable values

Personalization


  1. Go to settings

  2. You can set different colors for traits, structures, enums, etc.

  3. Customize your combinations


Cargo


There is a window for working with Cargo


Also popular now: