Generic Types Exercises

An empowering dive into Generic Type in Rust - Learn how Rust's generic types enable you to write flexible and reusable code by abstracting over types in functions and data structures. You'll put this understanding into practice by refactoring tuple-accessing functions and a `Rectangle` struct to make them generic.


1. Generic Types
A foundational exploration of Understanding Generic Types in Rust - Discover how Rust's generics enable flexible, reusable code by examining built-ins like `Option<T>` and `Vec<T>`. Learn to define custom generic structs and functions, and understand monomorphization's role in efficient, type-safe code. Duration: 8min
2. Generic Types Exercises
An empowering dive into Generic Type in Rust - Learn how Rust's generic types enable you to write flexible and reusable code by abstracting over types in functions and data structures. You'll put this understanding into practice by refactoring tuple-accessing functions and a `Rectangle` struct to make them generic. Reading Time: 0min
3. Method
An essential primer on Defining Behavior: Methods and Static Methods on Rust Structs - Learn to define functions within `impl` blocks for your Rust structs, distinguishing between instance methods (that take `self`) and static methods (associated with the type, like `new`). You'll implement a `Point` struct with `move_to` (instance) and `new` (static) methods, mastering their syntax and usage. Duration: 5min
4. Method Exercises
A practical guide to implementing Rust Methods - Learn to define behavior for your structs using associated functions (like `new`) and instance methods (`&self`, `&mut self`). You'll apply this by creating a `Point` struct, implementing `new` for instantiation and `move_to` to update its position. Reading Time: 0min
5. Trait
A comprehensive journey to Unlocking Polymorphism in Rust with Traits - Embark on defining shared behaviors in Rust using traits, a key to unlocking powerful polymorphism for your functions. You'll implement a `Compiler` trait for different types, utilize `&impl Trait` for flexible parameters, and enhance traits with default methods. Duration: 8min
6. Trait Exercises
A hands-on introduction to Rust Traits - Discover how traits define shared behavior, enabling flexible and reusable code in Rust. You'll implement a `Tester` trait for `Foundry` and `Cargo`, then build a generic function that leverages this trait. Reading Time: 0min
7. Generic Trait
An insightful exploration of Understanding Generic Traits in Rust - Discover how to craft flexible behavioral contracts by combining generics with traits, enabling operation over diverse types. Learn to define and implement a `List<T>` trait for concrete structures like tuples and generic collections like `Vec<T>`. Duration: 4min
8. Generic Trait Exercises
A hands-on exploration of Generic trait - Unlock the power of Rust's generic traits by implementing the versatile `Iterator` trait. Apply your skills to build custom iterators for tuple and vector structures, making your data types iterable. Reading Time: 0min
9. Trait Bound
An elucidating journey into Mastering Trait Bounds in Rust - Discover how trait bounds are key to Rust's generic programming, ensuring types have necessary capabilities. You'll learn to apply single and multiple bounds, and use the `where` clause for crafting clean, flexible generic functions. Duration: 6min
10. Trait Bound Exercises
A foundational guide to Rust's Trait Bound - Discover how trait bounds enable you to write generic functions that work with any type implementing specific behaviors. You'll put this knowledge to use by generalizing a `min` function with the `PartialOrd` trait and a `zip` function with the `Copy` trait. Reading Time: 0min
11. Lifetime
A demystifying guide to Rust Lifetimes - Unravel how Rust's lifetime system prevents dangling references, forming the bedrock of its compile-time memory safety. Learn to confidently apply explicit lifetime annotations to functions, structs, and methods, ensuring all references remain valid. Duration: 5min
12. Lifetime Exercises
A core primer to Lifetime - Discover how Rust's lifetime system ensures memory safety by validating references throughout your code. You'll practice applying lifetime annotations to resolve compiler issues and make programs more robust. Reading Time: 0min
13. Iterator
A clarifying exploration of Rust's Core Iteration Methods: `into_iter`, `iter`, & `iter_mut` - Demystify why Rust's `for` loop consumes collections by default and how `iter()` enables repeated, non-consuming loops. Learn to wield `into_iter()` for owned values, `iter()` for shared references, and `iter_mut()` for in-place mutable access to your data. Duration: 2min
14. Iterator Adaptors
A hands-on tour of Mastering Iterators in Rust: `map`, `filter`, and `collect` - Learn to transform data using `map`, refine selections with `filter`, and aggregate results into diverse collections via `collect`. Master the art of chaining these iterator methods for clean, efficient, and powerful data manipulation in Rust. Duration: 8min
15. Iterator Adaptors Exercises
An empowering guide to Iterator adaptors - Learn to harness Rust's iterator adaptors to chain operations, transforming data with methods like `filter` and `map`, and gathering results with `collect`. Solidify your understanding by implementing functions to filter numeric vectors, convert string types, and construct HashMaps. Reading Time: 0min

Course Overview

About the course

What you'll learn

Introduction to the Rust programming language

Rust variables and functions

Scalar types, arrays, strings, enum, structs, vectors, and hash maps in Rust

Rust control flows: If / else, if let and let else, loop, match

Rust ownership, including borrow and references

Rust error handling

Rust Modules

Rust Traits

Course Description

Who is this course for?

  • Smart Contract Developers
  • Blockchain Engineers
  • Web3 Developers
  • Smart Contract Security Researchers
  • Solutions Architects

Meet your instructors

Tasuku Nakamura

Tasuku Nakamura

Founder at smartcontract.engineer

Smart contract engineer and educator.

Last updated on July 11, 2025