Featured

Rust Lifetimes Simplified

This guide is an attempt to simplify Rust Lifetimes, it’s a series and will be divided into several chapters. We’ll start with chapter one today. Chapter 1 Lifetimes and its benefits In Rust programming, lifetimes is a critical yet misunderstood concept. Assuming we are not talking about programming, when we talk about lifetimes what comes to mind? According to Oxford Dictionary, a lifetime is the duration of a person’s life…

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.…

Higher-Order Functions in Javascript

Functions are a fundamental building block of JavaScript. They can be used to perform calculations, manipulate data, and control the flow of execution. In JavaScript, functions are also first-class citizens, which means that they can be treated like any other value. First-class citizen in a programming language means that an entity (such as a function) has the same properties and abilities as other entities. This means that functions can be:…

Promises In Javascript

Promises In Javascript In this guide, we’ll learn the basics of what a Promise is in Javascript, the why, and how you can use them. Table of content What is a Promise in Javascript First of all, do not overthink the meaning of the term Promise it’s exactly the same promise you know. You know how your mom promises to get you a new cartoon series if you come out with the…

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…