"hello-rust" is a beginner-friendly Rust project demonstrating the basics of Rust programming, including project setup, common programming concepts, writing and running simple tests.
This repository covers material from Chapter 3 - Common Programming Concepts of The Rust Programming Language Book.
You will learn how to:
- Declare variables and constants
- Work with data types
- Write and call functions
- Control flow (
if,else,loop,while,for) - Basic testing (
cargo test)
These instructions will help you set up and explore the project on your local machine.
Install Rust and Cargo
git clone https://github.com/rust-logs/hello-rust.git
cd hello-rustsrc/main.rs- Entry point of the applicationsrc/lib.rs- Library file where reusable functions are definedtests/test.rs- Contains tests to verify your code works as expected
cargo build # compiles the project
cargo run # runs the projectYou should see output like:
Hello, Rust
Try modifying the name function in lib.rs and cargo run again to see how the output changes
This project includes a simple test for the name function.
cargo testYou should see output indicating whether tests passed or failed.
You can add your own tests in tests/test.rc
We welcome beginner-friendly contributions
If you'd like to add examples, improve explanations, or fix typos, please read our Contributing Guide before starting.
It includes step-by-step instructions for forking the repo, creating branches, and submitting pull requests.
This project follows a Code of Conduct to ensure safe and welcoming learning environment for everyone.
Please read it before participating in discussions or contributing.
This project is licensed under the MIT License. See LICENSE for more details