Lesson 15

Next Steps and Mini Capstone

Review the learning path and build a small Rust project to strengthen your skills.

Learning objectives

What You Have Learned

You have explored variables, data types, control flow, functions, ownership, borrowing, structs, enums, collections, errors, file operations, traits, generics, and a small command-line project.

Mini Capstone Project

Build a simple Student Marks Manager. It should allow sample student records, calculate average marks, identify the highest mark, and print a clear report.

Where to Go Next

After this short tutorial, continue with deeper topics such as Cargo packages, testing, lifetimes, async programming, web APIs, databases, and production deployment.

Example code

struct Student {
    name: String,
    mark: u32,
}

fn average(students: &Vec<Student>) -> f64 {
    let total: u32 = students.iter().map(|s| s.mark).sum();
    total as f64 / students.len() as f64
}

fn main() {
    let students = vec![
        Student { name: String::from("Alice"), mark: 88 },
        Student { name: String::from("Ben"), mark: 76 },
        Student { name: String::from("Carmen"), mark: 92 },
    ];

    println!("Student Report");
    for student in &students {
        println!("{} - {}", student.name, student.mark);
    }

    println!("Average mark: {:.2}", average(&students));
}
Practice task: Complete the capstone by adding highest mark, lowest mark, and pass/fail summary.