Top Companies Using Rust and their career page

Since the release of Rust first version on the 15th of May, 2015, there has been increasing adoption of Rust by major tech companies. This is a curated list of companies leveraging Rust and their career page, so, you can easily find them and apply if you need to. Amazon Amazon is one of the 5 big tech companies in the US and the largest retailer of e-commerce. They use…

Understanding Closures in Rust

Like several other languages, Rust programming language supports closures also known as anonymous functions or lambda functions which is a powerful feature used for varying reasons depending on who you ask. We’ll break down closures in Rust in this article, so you can start using it in your Rust code immediately and properly. A closure in Rust is a function without a name that can be used as a variable.…

Rust’s Newtype Pattern: Adding Type Safety and Clarity

The newtype pattern is a Rust idiom that can be used to add type safety and clarity to code. It works by wrapping a basic type in a new type, which gives the new type distinct behavior and prevents misuse. Let’s consider this code as an example and break it down: In the code above, we use the newtype pattern to create a type called Years that represents a person’s…

Building a Basic RESTful Web Server in Rust

What comes to mind when you think of building a web server with Rust? I bet you think of using Axum, Rocket, Actix, etc., right? These are mature frameworks for building web applications with Rust. By the end of this article, we’ll learn how to build a web server of our own that will receive a get or post request and respond to it without any of those shiny frameworks.…

Making Your Python Code Faster Using Rust

Python is an interpreted and dynamically typed programming language, that has become increasingly popular for many reasons, a few of which include its simplicity compared to other programming languages such as C, C++, and Java. It allows you to accomplish more with less code due to its wide range of libraries. Additionally, it has a very large and supportive community, making it a preferred choice for academic and research work.…

Rust mem::swap Function for Value Swapping

In Rust programming language, memory efficiency, and safety is a feature. The mem::swap function, allows you to swap values between variables efficiently. Understanding mem::swap: In Rust, the std::mem module offers a collection of functions that deal with memory-related operations. Among them, the swap function stands out as a convenient way to exchange the values of two variables. The function is designed to work with mutable references to variables, allowing for…

mem::take Vs mem::replace

mem::take and mem::replace are both used to manipulate ownership and values, but they work slightly differently. Here’s a simple comparison: mem::take example: mem::replace example: In summary, mem::take replaces the original value with a default value and gives you the original value back, while mem::replace lets you replace the value with a new value and also gives you the original value. The choice between them depends on whether you want to…

Mem::replace in Rust

mem::replace is a Rust standard library function that swaps a value in a variable with a new value while returning the original value. In Rust, when you move data out of a container like Vec or Option, the container can no longer be directly used, as its contents have been moved and it is considered empty or invalidated. Imagine a scenario where you want to take the data out of…

Box Smart Pointer in Rust

Box smart pointer is a pointer in Rust that allows you to allocate memory on the heap, even though the Box pointer itself exists in the stack. Key notes: To create a Box, you can use the Box::new() function. This function takes the value that you want to store on the heap and returns a Box that points to the allocated memory. You can access the data stored in the…

Understanding Dereferencing in Rust

Dereferencing is how we access the value that a reference points to. References are like signposts that guide us to the actual data. Imagine them as arrows pointing to a treasure! 💎 Technically, a pointer stores the address of another variable in memory. So, if we do something like the example below: my_ref will hold the address of x in memory. In that case, x is not equal to my_ref, make…