How to Print a Raw Pointer in Rust?

The other day I wrote an article about the dereference unary operator (*) and I needed a way to explain the unary operator by first explaining about pointers in Rust, which are the memory address location of, for example, a variable. However, I didn’t know how to print the pointer of a variable, without displaying … Read more

Rust | (Solved) “Missing type for `const` or `static`”

Have you come across the following error error: missing type for const item in Rust? Chances are, you defined a constant value like this: At first, this doesn’t seem to be an error as Rust is capable of implicitly determine the data type of other non-constant scoped variables (let ) like the one you see … Read more

What is the Meaning of the Asterisk * Symbol in Rust?

Have you recently seen the asterisk (*) symbol in Rust while reading someone else’s code and you are not sure what it means? No worries, this article will explain the meaning of * and show you how it can become handy during development. The asterisk (*) symbol is Rust’s dereference unary operator. The dereference operator … Read more

(Solved) error: toolchain ‘nightly-x86_64-pc-windows-msvc’

Have you ever cloned a Rust project on your local machine, installed all its dependencies, and attempted to compile it but you came across the error error: toolchain ‘nightly-x86_64-pc-windows-msvc’ is not installed. No worries, here is how you can fix this error. To fix the error error: toolchain ‘nightly-x86_64-pc-windows-msvc’ is not installed , make sure … Read more

Rust | Difference between then() vs and_then() vs or_else()

As you learn Rust, you find out more and more functions that sound like they behave in a similar way, when in reality they differ in subtle ways. This is the case for the functions then() , and_then() , and or_else(). No worries, this article will cover each of these methods as well as their … Read more

Rust Error Handling | How to Define Generic Error Types?

Result<T,E> is a common data type that allows propagating Rust errors without necessarily crashing the Rust program unless the program panics. The Result<T, E> is made out of T or generic data type when the result is Ok(T) or Err(E) whenever an error occurs. One common question new Rust developers ask is: How do you … Read more

Rust | How To Build A Rust API Using Hyper? (Step-by-step)

APIs are a key component of modern applications no matter the programming language they are written. Learning how to build a Rust API can be seen as a challenging task, especially on a programming language that is considered hard and with a steep learning curve. Hopefully, you will learn how to build a Rust API … Read more

Rust | How to Read User Input (stdin) In Rust?

It is common to learn how to detect user input (stdin) when learning a new programming language, and Rust is not the exception. In this article, you will learn how to read the user input from a terminal. Here are the steps to read user input (stdin) in Rust: Import the std::io crate Generate a … Read more

Rust | The Difference Between .clone() and .to_owned()

Chances are you recently came across the definition of the ToOwned trait to realize it is a generalization of the Clone trait? If so, what is the difference between the two traits? more specifically, what is the difference between .clone() and .to_owned() if they work the same? A generalization of Clone to borrowed data. https://doc.rust-lang.org/std/borrow/trait.ToOwned.html#tymethod.to_owned … Read more