Skip to content

YetAnotherFactsEnjoyer/Rust-Learning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

33 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ¦€ Rust Learning

A personal Rust practice repository built around Rustlings and pool-style exercises

Rust Cargo Learning Exercises


Rust Learning is a hands-on repository for practicing Rust fundamentals through small exercises, algorithmic challenges, and Rustlings-style learning modules.


✨ Overview

This repository is my Rust learning playground.

It contains two main parts:

  • πŸ§ͺ Pool Exercises β€” small Rust projects focused on logic, strings, arrays, math, and basic algorithms.
  • πŸ“š Rustlings Exercises β€” guided exercises covering Rust syntax, ownership, borrowing, enums, traits, lifetimes, iterators, smart pointers, threads, macros, and more.

The goal is simple: learn Rust by writing Rust.


🧠 What I’m Practicing

This repo covers core Rust concepts such as:

  • Variables and mutability
  • Functions
  • Conditionals
  • Primitive types
  • Strings and arrays
  • Ownership and move semantics
  • Structs and enums
  • Pattern matching
  • Error handling
  • Generics
  • Traits
  • Lifetimes
  • Tests
  • Iterators
  • Smart pointers
  • Threads
  • Macros
  • Clippy
  • Type conversions
  • Basic algorithms

πŸ“ Project Structure

Rust-Learning-main/
β”œβ”€β”€ Pool-Exercise/
β”‚   β”œβ”€β”€ poold1/
β”‚   β”‚   β”œβ”€β”€ Cargo.toml
β”‚   β”‚   └── src/
β”‚   β”‚       β”œβ”€β”€ main.rs
β”‚   β”‚       β”œβ”€β”€ isneg.rs
β”‚   β”‚       β”œβ”€β”€ my_print_alpha.rs
β”‚   β”‚       β”œβ”€β”€ print_comb.rs
β”‚   β”‚       β”œβ”€β”€ print_comb2.rs
β”‚   β”‚       β”œβ”€β”€ print_combn.rs
β”‚   β”‚       β”œβ”€β”€ print_digit.rs
β”‚   β”‚       └── rev_alpha.rs
β”‚   β”‚
β”‚   β”œβ”€β”€ poold2/
β”‚   β”‚   β”œβ”€β”€ Cargo.toml
β”‚   β”‚   └── src/
β”‚   β”‚       β”œβ”€β”€ main.rs
β”‚   β”‚       β”œβ”€β”€ get_nbr.rs
β”‚   β”‚       β”œβ”€β”€ my_swap.rs
β”‚   β”‚       β”œβ”€β”€ putstr.rs
β”‚   β”‚       β”œβ”€β”€ rev_str.rs
β”‚   β”‚       β”œβ”€β”€ sort_arr.rs
β”‚   β”‚       └── str_len.rs
β”‚   β”‚
β”‚   β”œβ”€β”€ poold3/
β”‚   β”‚   β”œβ”€β”€ Cargo.toml
β”‚   β”‚   └── src/
β”‚   β”‚       β”œβ”€β”€ main.rs
β”‚   β”‚       β”œβ”€β”€ comp_fac_it.rs
β”‚   β”‚       β”œβ”€β”€ comp_fac_rec.rs
β”‚   β”‚       β”œβ”€β”€ comp_pow_it.rs
β”‚   β”‚       β”œβ”€β”€ comp_pow_rec.rs
β”‚   β”‚       β”œβ”€β”€ comp_sq_root.rs
β”‚   β”‚       └── my_isprime.rs
β”‚   β”‚
β”‚   └── poold4/
β”‚       β”œβ”€β”€ Cargo.toml
β”‚       └── src/
β”‚           β”œβ”€β”€ main.rs
β”‚           β”œβ”€β”€ strcmp.rs
β”‚           β”œβ”€β”€ strcpy.rs
β”‚           └── strstr.rs
β”‚
β”œβ”€β”€ Rustlings/
β”‚   └── exercises/
β”‚       β”œβ”€β”€ 00_intro/
β”‚       β”œβ”€β”€ 01_variables/
β”‚       β”œβ”€β”€ 02_functions/
β”‚       β”œβ”€β”€ 03_if/
β”‚       β”œβ”€β”€ 04_primitive_types/
β”‚       β”œβ”€β”€ 05_vecs/
β”‚       β”œβ”€β”€ 06_move_semantics/
β”‚       β”œβ”€β”€ 07_structs/
β”‚       β”œβ”€β”€ 08_enums/
β”‚       β”œβ”€β”€ 09_strings/
β”‚       β”œβ”€β”€ 10_modules/
β”‚       β”œβ”€β”€ 11_hashmaps/
β”‚       β”œβ”€β”€ 12_options/
β”‚       β”œβ”€β”€ 13_error_handling/
β”‚       β”œβ”€β”€ 14_generics/
β”‚       β”œβ”€β”€ 15_traits/
β”‚       β”œβ”€β”€ 16_lifetimes/
β”‚       β”œβ”€β”€ 17_tests/
β”‚       β”œβ”€β”€ 18_iterators/
β”‚       β”œβ”€β”€ 19_smart_pointers/
β”‚       β”œβ”€β”€ 20_threads/
β”‚       β”œβ”€β”€ 21_macros/
β”‚       β”œβ”€β”€ 22_clippy/
β”‚       β”œβ”€β”€ 23_conversions/
β”‚       └── quizzes/
β”‚
└── README.md

🏊 Pool Exercises

The Pool-Exercise folder contains independent Cargo projects split by learning day.

poold1

Basic output and number-combination exercises.

Implemented exercises include:

File Purpose
my_print_alpha.rs Print the alphabet.
rev_alpha.rs Print the alphabet in reverse.
print_digit.rs Print digits.
isneg.rs Check whether a number is negative.
print_comb.rs Print digit combinations.
print_comb2.rs Print two-number combinations.
print_combn.rs Print combinations of n digits.

poold2

String, array, and pointer-style logic practice.

Implemented exercises include:

File Purpose
putstr.rs Print a string.
str_len.rs Get string length.
rev_str.rs Reverse a string.
my_swap.rs Swap values.
sort_arr.rs Sort an array.
get_nbr.rs Convert string input into a number.

poold3

Math and recursion exercises.

Implemented exercises include:

File Purpose
comp_fac_it.rs Compute factorial iteratively.
comp_fac_rec.rs Compute factorial recursively.
comp_pow_it.rs Compute power iteratively.
comp_pow_rec.rs Compute power recursively.
comp_sq_root.rs Compute square root.
my_isprime.rs Check prime numbers and find the next prime.

poold4

String comparison and search exercises.

Implemented exercises include:

File Purpose
strcpy.rs Copy string behavior.
strcmp.rs Compare strings.
strstr.rs Find a substring inside another string.

πŸ“š Rustlings

The Rustlings folder contains guided Rust exercises organized by topic.

Covered sections include:

Section Topic
00_intro Getting started
01_variables Variables and mutability
02_functions Functions
03_if Conditions
04_primitive_types Primitive types
05_vecs Vectors
06_move_semantics Ownership and moves
07_structs Structs
08_enums Enums
09_strings Strings
10_modules Modules
11_hashmaps HashMaps
12_options Option type
13_error_handling Result and error handling
14_generics Generics
15_traits Traits
16_lifetimes Lifetimes
17_tests Tests
18_iterators Iterators
19_smart_pointers Smart pointers
20_threads Threads
21_macros Macros
22_clippy Clippy checks
23_conversions Type conversions
quizzes Mixed-topic quizzes

πŸš€ Running the Pool Exercises

Each pool day is its own Cargo project.

Example:

cd Pool-Exercise/poold1
cargo run

Run another day:

cd Pool-Exercise/poold2
cargo run

Or:

cd Pool-Exercise/poold3
cargo run

Or:

cd Pool-Exercise/poold4
cargo run

πŸ› οΈ Requirements

Make sure Rust is installed:

rustc --version
cargo --version

If Rust is not installed yet, install it with rustup:

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

πŸ§ͺ Useful Commands

Build a project

cargo build

Run a project

cargo run

Check code without building an executable

cargo check

Format code

cargo fmt

Run Clippy

cargo clippy

🧩 Example

Inside poold2, the current main.rs sorts an array:

mod sort_arr;
use sort_arr::sort_arr;

fn main() {
    let mut nbs = [2, 1, 4, 2, 5];
    let size = nbs.len();

    sort_arr(&mut nbs, size);
    println!("Sorted {:?}", nbs);
}

Expected output:

Sorted [1, 2, 2, 4, 5]

🎯 Goal

The goal of this repository is not to be perfect.

The goal is to improve step by step by building small things, breaking stuff, fixing errors, and getting more comfortable with Rust’s way of thinking.


πŸ“Œ Learning Roadmap

Current focus:

  • Write more Rust every day
  • Understand ownership deeply
  • Get comfortable with borrowing and lifetimes
  • Practice algorithmic thinking
  • Use Cargo properly
  • Learn how to structure Rust projects cleanly
  • Build confidence with compiler errors

πŸ¦€ Why Rust?

Rust is fast, safe, and strict in the best way.

It forces better habits around memory, ownership, types, and error handling while still giving low-level control.

This repository tracks that learning journey.


Built while learning Rust, one compiler error at a time. πŸ¦€πŸ”₯

About

I'm just learning rust πŸ’€

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages