Skip to content

This repository contains various examples and exercises to learn Rust programming language. The examples are based on the [Rust By Example](https://doc.rust-lang.org/rust-by-example/index.html) book.

Notifications You must be signed in to change notification settings

sumit03guha/rust-by-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust By Example

This repository contains various examples and exercises to learn Rust programming language. The examples are based on the Rust By Example book.

Project Structure

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.

Examples

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.

Running the Examples

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

About

This repository contains various examples and exercises to learn Rust programming language. The examples are based on the [Rust By Example](https://doc.rust-lang.org/rust-by-example/index.html) book.

Topics

Resources

Stars

Watchers

Forks

Languages