Playground

If you just want to try a bit of Rust code or check the syntax for a definition in a Rust library. You might also be looking for a way to share some code with others.

The Rust language offers support for these tasks in the Rust playground.

https://play.rust-lang.org/

In the playground, you can access methods and functions in the Rust std standard library.

The top 100 most-downloaded crates in the crates.io library are also available along with their dependencies.


Demo

Let's try with a simple example.

fn main(){println!(Welcome to Rust!);}
Image Src: Microsoft Rust Documentation

The tool adjusts the code to follow official Rust styles:

Image Src: Microsoft Rust Documentation

Select Tools > Clippy to check for mistakes in the code. The results are displayed under the editor:

Image Src: Microsoft Rust Documentation

To fix the sample code, add quote marks around the text "Welcome to Rust!":

Image Src: Microsoft Rust Documentation

Now we'll compile the code and run the program.

Image Src: Microsoft Rust Documentation