DEV Community

Eleftheria Batsou
Eleftheria Batsou

Posted on • Originally published at eleftheriabatsou.hashnode.dev

5 Rust Project Ideas For Beginner Devs 🦀

Image description

Hey there, welcome back to my blog! 👋

If you're learning Rust for the very first time I want to introduce you to 5 simple yet practical projects that will help you later in real-world projects. I wrote another article with 5 ideas, this is one step up on the learning ladder.

The concepts I'm presenting below are pretty basic; every Rust developer should know them.

Below you'll find the 5 project ideas, the posts (tweets) where I'm explaining step-by-step how you can build these projects and a link to the corresponding GitHub repo!

Project Idea 5: Simple Get Request

In the above post, I'm explaining how to make a GET request using the reqwest crate in Rust, handle the response, and print the status code, headers, and body of the response. Additionally, in the code, you'll find the error_chain crate for error handling.

Check it on GitHub.

Project Idea 4: Asynchronous GET Request

If you try this code for yourself you'll learn how to:

  • Make an asynchronous GET request using the reqwest crate in Rust

  • Handle the response asynchronously using async and await

  • Print the status code, headers, and body of the response

Check it on GitHub.

Project Idea 3: Making API Calls

If you completed the above projects I suggest you now work with API calls. In the project I'm presenting here you'll be able to learn how to:

  • Make an HTTP GET request to an API endpoint using the reqwest crate

  • Handle the response asynchronously using async and await

  • Deserialize the JSON response into Rust structs using serde

  • Additionally, you can use the User-Agent header in the request to identify the client making the request

Check it on GitHub.

Project Idea 2: Very Basic Authentication

Overall, after finishing this project you'll be able to: make a synchronous GET request to a URL using the reqwest crate and also add basic authentication to the request and handle the response.

Check it on GitHub.

Project Idea 1: Download an Image

This idea about this project is about downloading an image from a specified URL (in this case, the Rust logo image from the Rust website) and saving it to a temporary directory on the local file system.

Here's an overview of what the program does:

  1. It creates a temporary directory using tempfile::Builder.

  2. It specifies the URL of the image to be downloaded (https://rust-lang.org/logos/rust-logo-512x512.png).

  3. It sends an asynchronous GET request to the specified URL using the reqwest crate.

  4. It extracts the file name from the response URL and creates a file with that name in the temporary directory.

  5. It reads the content of the response body as text asynchronously.

  6. It copies the content of the response body, represented as bytes, to the file created in the temporary directory.

  7. It prints information about the downloaded file, such as the file name and the location where it is stored in the temporary directory.

  8. It returns Ok(()), indicating that the program executed successfully.

Check it on GitHub.

Notes

I'm new to Rust and I hope these small projects will help you get better and improve your skills. Check here part 1 of Rust project ideas for beginners and if you need more resources I'd also like to suggest Akhil Sharma's YouTube Channel.


👋 Hello, I'm Eleftheria, Community Manager, developer, public speaker, and content creator.

🥰 If you liked this article, consider sharing it.

🔗 All links | X | LinkedIn

Top comments (2)

Collapse
 
binezir profile image
Binezir

👍👍👍

Collapse
 
tiagorcorreia profile image
Tiago Correia • Edited