How to run Rust in VS Code ?

The cargo init command creates a new Cargo project in the current directory. It does this by creating a Cargo.toml file, which is the manifest file for Cargo projects. The Cargo.toml file contains information about the project, such as its name, dependencies, and build instructions.

The cargo init command also creates a src/ directory, where the project's source code will be stored. By default, the cargo init command creates a main.rs file in the src/ directory. This is the entry point for the Rust program.
You can write rust code in the `main.rs`.

To run your code, you can click the run icon(on the top right), but it will not work when you have to take input, because it will run the code in the output section.

Learn More

Tags: Run Rust