- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Mukul Latiyan has Published 474 Articles
Mukul Latiyan
339 Views
Path struct in Rust is used to represent the file paths in the underlying filesystem. It should also be noted that a Path in Rust is not represented as a UTF-8 string; instead, it is stored as a vector of bytes (Vec).ExampleConsider the example shown below − Live Demouse std::path::Path; ... Read More
Mukul Latiyan
193 Views
Handling critical errors in Rust is done with the help of panic! Macro. There are other ways to handle errors in Rust, but panic is unique in the sense that it is used to deal with unrecoverable errors.When we execute the panic! Macro, the whole program unwinds from the stack, ... Read More
Mukul Latiyan
213 Views
Rust provides us with a match keyword that can be used for pattern matching. It is similar to the switch statement in C, and the first arm that matches is evaluated.ExampleConsider the example shown below −fn main() { let number = 17; println!("Tell me about {}", number); ... Read More
Mukul Latiyan
143 Views
Rust provides a loop keyword that allows us to run an infinite loop. The infinite loop indicated by the help of the loop keyword can be broken by the use of the break keyword. Also, we can exit an iteration and continue the infinite loop with the help of the ... Read More
Mukul Latiyan
478 Views
HashMap is an important data structure, as it allows us to store data in key-value pairs. In Rust, HashMap stores values by key.HashMap keys can be Boolean, Integer, strings or any other data type that implements the Eq and Hash traits.HashMaps can grow in size, and when the space becomes ... Read More
Mukul Latiyan
238 Views
From and Into are two traits that Rust provides us. They are internally linked.From TraitWe make use of From trait when we want to define a trait to how to create itself from any other type. It provides a very simple mechanism with which we can convert between several types.For ... Read More
Mukul Latiyan
114 Views
Also referred to as enumerations, enums are very useful in certain cases. In Rust, we use enums, as they allow us to define a type that may be one of a few different variants.Enumerations are declared with the keyword enum.Example Live Demo#![allow(unused)] #[derive(Debug)] enum Animal { Dog, Cat, } ... Read More
Mukul Latiyan
143 Views
Rust provides us with two types of constants. These are −const − an unchangeable valuestatic − possible mutable value with static lifetime.If we try to assign another value to an already declared const value, the compiler will throw an error.ExampleConsider the example shown below − Live Demostatic LANGUAGE: &str = "TutorialsPoint-Rust"; ... Read More
Mukul Latiyan
574 Views
Channels are a medium that allow communication to take place between two or more threads. Rust provides asynchronous channels that enable communication between threads.Channels in Rust allow a unidirectional flow of communication between two endpoints. These two endpoints are Sender and Receiver.ExampleConsider the example shown below −use std::sync::mpsc::{Sender, Receiver}; use ... Read More
Mukul Latiyan
313 Views
Casting or explicit conversion is only allowed in Rust, there’s no implicit conversion that the compiler of Rust does for us. It is known that, in many cases, implicit conversion can lead to data losses, which is not a good thing.Rules for converting between different types is pretty similar to ... Read More
To Continue Learning Please Login
Login with Google