about
04/13/2022
RustBites - Tooling
Rust Bite - Tooling
Development tools for Rust
1. Prologue
2. Visual Studio Code Editor:
-
The terminal panel, Figure 1 on the right, is placed by default at the bottom of the IDE window.
It works better for me to have in on the right. You can place it wherever you like with
settings (click Gear icon at left bottom -> settings):
Settings -> User -> Workbench -> Panel Default Location
-
By default the IDE shows a code Minimap on the right of the code editing panel. You can disable
that with:
Settings -> User -> TextEditor -> Minimap
- "ctrl /" to toggle comments on selected lines
- "ctrl [ and ctrl ]" to control indenting of selected lines
- Also, to open integrated terminal in any folder, right click any file in the folder and select "Open in Integrated Terminal". This is particularly useful when you open a workspace folder (any folder with .vscode subfolder).
- "settings -> Editor -> uncheck Accept Suggestion on Commit Character" to avoid many spurious insertions of unwanted suggestions.
- "settings -> search for menu -> select Menu Bar Visibility" to show/hide top menu
- "F11" to toggle full screen mode
- "View -> Command Palette -> .Net: Generate Assets for Build and Debug" enables Run -> Start Debugging. Have to have editor open in project directory.
- "ctrl K, ctrl T -> select editor theme" to select one of many alternatives
- "settings -> workbench -> appearance -> color customizations" to set terminal colors
- "File -> Preferences -> Settings" to change lots of defaults
- "File -> Preferences -> Settings -> user -> Features -> Terminal" to change Terminal defaults
- "View -> Command Pallet -> Preferences: Open Settings (JSON)" to edit any user setting manually
Settings Details
-
local project settings:
Debugging settings in launch.json and build settings in tasks.jsonFind in project's .vscode folder, as JSON files launch.json and tasks.jsonAccess by opening json file in code editor
-
user settings:
Hundreds of settings for Terminal, Keyboard mappings, ...Find in C:\Users\[userid]\AppData\Roaming\Code\User\settings.jsonAccess: View -> Command Pallet -> Preferences -> Open Settings(JSON)
-
default settings:
All available settings (most of which you don't want to change)Doesn't appear to be a physical json file.Access: View -> Command Pallet -> Preferences -> Open Default Settings(JSON)
3. Development Process:
Topic | Rust |
---|---|
Installation |
Rust: cargo, rustc, clippy
Download Rust.
That includes rustc - the rust compiler, cargo - a package manager, and other tools like clippy. This works for Windows and Linux.
Install Rust pluggin, RLS, from the pluggin dropdown in VSCode's left menu bar. That supports
intellisence and debugging. If you have any problems with that, this tutorial may help:
VSCode with Rust.
|
Work Flow
BuildOn-2.pdf page 6 |
Creating Projects:
In VS Code, open the parent folder where you want to create a new Rust project.
In the terminal issue the command:
That's why the new command ends with --name test_pkg. If you don't use a snake_case name
you will repeatedly get warnings about naming formats.
Now you can open the new folder from the File menu and run or start debugging. when you don't
need to debug just issue the command:
You create a library with the terminal command:
cargo builds the library starter code with test fixtures for unit tests. Once you have some
library code and corresponding tests, you run tests with the terminal command:
If you manually create an /examples folder as a sibling to the /src folder, you can put
demonstration code that uses the library and displays results on the termianl. To do that
use the command:
|
Building Applications |
|