Build a CLI in Rust, Error Handling and Project Structure - Full Crash Rust Tutorial for Beginners

Опубликовано: 10 Октябрь 2024
на канале: Francesco Ciulla
3,704
96

The Rust series is available here:
   • Rust Installation, Hello World, Hello...  

My Products
Rust book: https://mybook.to/YJI6DI
Rust Workbook: https://francescociulla.gumroad.com/l...
Rust Cheatsheet: https://francescociulla.gumroad.com/l...

Useful Links
ALL THE LINKS HERE: https://francescociulla.com

Learn Rust by Building a CLI Project.

Github link: https://github.com/FrancescoXX/rust-b...

This video is a hands-on tutorial for building a command-line interface (CLI) project in Rust.

It covers creating a new Rust project, writing functions for configuration parsing, and running tests. You'll learn about using structs and methods and managing errors with `panic!` and `Result`, and reading file content with proper error handling. The tutorial also shows how to organize your code by moving logic to an external lib.rs file. Plus, there's a little surprise at the end!

0:00 - Introduction and creating a new Rust project.
1:15 - Understanding Rust imports, writing a function to parse configuration, and conducting the first test.
5:09 - Defining and using structs and struct methods for better code organization.
9:18 - Handling errors gracefully with panic! and Result.
12:35 - Reading file content using a separate function with robust error handling.
16:14 - Utilizing an external lib.rs file to modularize the application's logic.
18:51 - Wrapping it all up with a surprise rap! 🎤