This repository contains various examples and exercises to learn Rust programming language. The examples are based on the Rust By Example book.
The project is organized into multiple Rust source files, each demonstrating different concepts and features of the Rust language. The main file and several example files are located in the src/bin
directory.
A simple "Hello, world!" program.
Examples demonstrating the use of closures in Rust.
Examples showing how to implement Debug
and Display
traits for custom types.
Examples demonstrating the use of From
and Into
traits for type conversions.
Examples of higher-order functions in Rust.
Examples illustrating the concept of lifetimes in Rust.
Examples showing how to implement the Display
trait for a custom list type.
Examples demonstrating the use of loops and returning values from loops.
Examples illustrating the concept of mutability in Rust.
Examples demonstrating partial moves in Rust.
Examples showing the use of PhantomData
for type safety.
Examples demonstrating the use of eprintln!
macro for printing to standard error.
Examples showing the use of Result
type and error handling in Rust.
Examples illustrating the use of structs in Rust.
To run any of the examples, use the following command:
cargo run --bin <example_name>
For example, to run the src/bin/closures.rs example, use:
cargo run --bin closures