Difference between revisions of "Rust Programming Language"
(Created page with "Rust is an advanced systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. Rust is designed to be safe and concurrent. It ach...") |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
Rust is an advanced systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. Rust is designed to be safe and concurrent. It achieves memory safety without using garbage collection and is known for its rich type system and ownership model which guarantee memory-safety and thread-safety. | Rust is an advanced systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. Rust is designed to be safe and concurrent. It achieves memory safety without using garbage collection and is known for its rich type system and ownership model which guarantee memory-safety and thread-safety. | ||
| − | Rust combines the speed and control of languages like C and C++ with strong safety guarantees that prevent many common programming errors (like null pointer dereferencing and data races) | + | Rust combines the speed and control of languages like C and C++ with strong safety guarantees that prevent many common programming errors (like null pointer dereferencing and data races). |
It combines low-level control over hardware with high-level abstractions, enabling developers to write reliable and efficient software. | It combines low-level control over hardware with high-level abstractions, enabling developers to write reliable and efficient software. | ||
| − | The contributor who helped to create the outline, content, code is '''Vishal Pokuri''' from VIT Vellore. The Spoken Tutorial Effort for '''Rust Programming language''' is being contributed by '''Ms. Nirmala Venkat, Ms.Ketki Bhamble and Ms. Madhuri Ganapathi''' from Spoken Tutorial project, IIT Bombay. | + | The contributor who helped to create the outline, content, code is '''Vishal Pokuri''' from VIT Vellore. The Spoken Tutorial Effort for '''Rust Programming language''' is being contributed by '''Ms. Nirmala Venkat, Ms.Ketki Bhamble''' and '''Ms. Madhuri Ganapathi''' from Spoken Tutorial project, IIT Bombay. |
| Line 49: | Line 49: | ||
*Constants | *Constants | ||
*Type Inference in Rust | *Type Inference in Rust | ||
| + | |||
| + | '''5.Control Flow''' | ||
| + | *Control Flow Statement | ||
| + | *if | ||
| + | *else if | ||
| + | *else | ||
| + | *loop | ||
| + | *for loop | ||
| + | *while loop | ||
| + | |||
| + | '''6.Functions''' | ||
| + | *Functions in Rust | ||
| + | *Declare a Function | ||
| + | *Passing parameters to a Function | ||
| + | *Function with return value | ||
| + | *Examples | ||
| + | |||
| + | '''7.Enums''' | ||
| + | *Enums in Rust | ||
| + | *Variants in Rust | ||
| + | *Explain with example | ||
| + | |||
| + | '''8.Pattern Matching''' | ||
| + | *About Pattern matching | ||
| + | *Match statement with example | ||
| + | *About Option and Result enum types | ||
| + | *Matching Option Type with example | ||
| + | *Result enum type with example | ||
| + | |||
| + | '''9.Pattern Types''' | ||
| + | *Pattern types in rust | ||
| + | *Irrefutable pattern | ||
| + | *refutable pattern | ||
| + | *if let expression with example | ||
| + | *while let expression with example | ||
| + | |||
| + | '''10.Arrays''' | ||
| + | *Arrays in Rust | ||
| + | *Array Index | ||
| + | *Mutable Array | ||
| + | *Different methods used in arrays | ||
| + | |||
| + | '''11. Tuples and Struct''' | ||
| + | *About Tuples | ||
| + | *Example for Tuples | ||
| + | *Destructuring Tuples | ||
| + | *About Rust struct or structures | ||
| + | *Example for Struct | ||
| + | |||
| + | '''12.Strings''' | ||
| + | *About String data type | ||
| + | *String Literal | ||
| + | *String Slice | ||
| + | *String Objects | ||
| + | *common methods used with string objects | ||
| + | |||
| + | '''13.Ownership''' | ||
| + | *About Ownership | ||
| + | *Ownership Rules | ||
| + | *Drop and Copy traits | ||
| + | *Example for Drop trait | ||
| + | *Example for Copy trait | ||
| + | |||
| + | '''14. Borrowing''' | ||
| + | *About Borrowing | ||
| + | *Rules of Borrowing | ||
| + | *Example for rules of Borrowing | ||
| + | *Dangling reference with example | ||
| + | |||
| + | '''15. Collections''' | ||
| + | *Collections | ||
| + | *Types of Collections | ||
| + | *Vectors with example | ||
| + | *HashMap with example | ||
| + | *HashSet with example | ||
| + | |||
| + | '''16. Iterators and Closures''' | ||
| + | *About Iterators | ||
| + | *Types of Iterators | ||
| + | *Basic and Range Iterators | ||
| + | *Iterator Adapters | ||
| + | *Iterator Consumers/Collectors | ||
| + | *Closures | ||
| + | *Example for Iterators and Closures | ||
| + | |||
| + | '''17. Error Handling''' | ||
| + | *Error Handling | ||
| + | *Typed of errors | ||
| + | *Recoverable Errors | ||
| + | *Unrecoverable Errors | ||
| + | *Error Propagation Operator | ||
| + | *Examples for the above errors | ||
| + | |||
| + | '''18. File Handling''' | ||
| + | |||
| + | *File operations | ||
| + | *Input and Output operations | ||
| + | *Creating a file | ||
| + | *Writing to a file | ||
| + | *Reading from a file | ||
| + | *Appending, Reading and Writing using Openoptions | ||
| + | *Deleting a file | ||
| + | |||
| + | '''19. Path Struct''' | ||
| + | *About Path Struct | ||
| + | *Common methods of Path struct | ||
| + | *Example to check if a file exists | ||
| + | *Example to check if it is a file or directory | ||
| + | *Example to read from the keyboard and write to the terminal | ||
Latest revision as of 13:13, 29 October 2025
Rust is an advanced systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. Rust is designed to be safe and concurrent. It achieves memory safety without using garbage collection and is known for its rich type system and ownership model which guarantee memory-safety and thread-safety.
Rust combines the speed and control of languages like C and C++ with strong safety guarantees that prevent many common programming errors (like null pointer dereferencing and data races). It combines low-level control over hardware with high-level abstractions, enabling developers to write reliable and efficient software.
The contributor who helped to create the outline, content, code is Vishal Pokuri from VIT Vellore. The Spoken Tutorial Effort for Rust Programming language is being contributed by Ms. Nirmala Venkat, Ms.Ketki Bhamble and Ms. Madhuri Ganapathi from Spoken Tutorial project, IIT Bombay.
Contents
Basic Level
1. Installation of Rust on Linux
- About Rust
- Installation of Rust on Linux
- Check for Curl installation
- Install modules and packages like cargo, rustfmt, clippy
- Set up an Integrated Development Environment(IDE)
- Install Visual Studio Code
- Install rust-analyzer
- Verify the version after installation is done
- About Rust compiler and Tool Chain Manager
- Write and compile a Hello world program
2. Hello World using Cargo
- About Cargo
- About Cargo commands
- Create a Rust project using Visual Studio code
- Add a program in main.rs
- Explore Rust program structure
- Save the program
- Build the Rust program
- Run the Rust program
- Check the output
- Edit the program and re-run the program
3.Variables and Mutability
- Variables in Rust
- Mutabilty in Rust
- Mutable variable with example
- Shadowing of variables
- Scope of variables
4.Data Types
- Data types in Rust
- Scalar Data type with example
- Constants
- Type Inference in Rust
5.Control Flow
- Control Flow Statement
- if
- else if
- else
- loop
- for loop
- while loop
6.Functions
- Functions in Rust
- Declare a Function
- Passing parameters to a Function
- Function with return value
- Examples
7.Enums
- Enums in Rust
- Variants in Rust
- Explain with example
8.Pattern Matching
- About Pattern matching
- Match statement with example
- About Option and Result enum types
- Matching Option Type with example
- Result enum type with example
9.Pattern Types
- Pattern types in rust
- Irrefutable pattern
- refutable pattern
- if let expression with example
- while let expression with example
10.Arrays
- Arrays in Rust
- Array Index
- Mutable Array
- Different methods used in arrays
11. Tuples and Struct
- About Tuples
- Example for Tuples
- Destructuring Tuples
- About Rust struct or structures
- Example for Struct
12.Strings
- About String data type
- String Literal
- String Slice
- String Objects
- common methods used with string objects
13.Ownership
- About Ownership
- Ownership Rules
- Drop and Copy traits
- Example for Drop trait
- Example for Copy trait
14. Borrowing
- About Borrowing
- Rules of Borrowing
- Example for rules of Borrowing
- Dangling reference with example
15. Collections
- Collections
- Types of Collections
- Vectors with example
- HashMap with example
- HashSet with example
16. Iterators and Closures
- About Iterators
- Types of Iterators
- Basic and Range Iterators
- Iterator Adapters
- Iterator Consumers/Collectors
- Closures
- Example for Iterators and Closures
17. Error Handling
- Error Handling
- Typed of errors
- Recoverable Errors
- Unrecoverable Errors
- Error Propagation Operator
- Examples for the above errors
18. File Handling
- File operations
- Input and Output operations
- Creating a file
- Writing to a file
- Reading from a file
- Appending, Reading and Writing using Openoptions
- Deleting a file
19. Path Struct
- About Path Struct
- Common methods of Path struct
- Example to check if a file exists
- Example to check if it is a file or directory
- Example to read from the keyboard and write to the terminal