#Rust – Install Rust and Hello World ๐ŸŒ in #RaspberryPi

Hi !

Quick post today on how to install rust in a Raspberry Pi, and later create a hello world test app.

Install Rust

I’m starting this with the latest updates for Raspberry Pi OS installed.

current raspberry pi os installed

The command to install rust is this one:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Check the Rust Lang documentation for more details.

Let’s choose the default installation, this may take a couple of minutes.

And now, we can check the rust and cargo versions with the following commands

rustc --version
cargo --version
checking rust and cargo versions with command line

Hello World project

Now let’s use cargo to create a new project. I’ll name it “DemoBlogPost”. In the following image, we can check the default contents of the project

  • cargo.toml
  • src/main.rs
createing a new project with cargo and check the generated files

Time to edit the main.rs file. I’m not a VIM user, so it’s nano time.

editing the main rs file with nano

And now, time to run the project !

Super fun and literally a great way to use a device like a raspberry pi to learn Rust !

Happy coding!

Greetings

El Bruno

More posts in my blog ElBruno.com.

More info in https://beacons.ai/elbruno


Advertisement

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: