Author: Ankit Mogha

Design Patterns in Rust Programming

Reading Time: 3 minutes The Design Patterns are programming language independent strategies for solving a common problem. By using design patterns, you can make your code more flexible, reusable, and maintainable. These solutions were obtained by trial and error by numerous software developers. Types of Design Patterns There are following types of design Patterns in Rust for solving our problems : Behavioural Creational Behavioural Patterns Behavioural design pattern are design patterns that Continue Reading

How to Tackle Error in Rust Programming

Reading Time: 3 minutes An Error is basically an unexpected behaviour that may lead a program to produce undesired output or terminate abruptly. Error handling is the process of handling the possibility of failure. In Rust, errors can be classified into two major categories. Recoverable UnRecoverable Recoverable Error Recoverable errors are those that do not cause the program to terminate abruptly. Such as a file not found error . Continue Reading

How to use Pattern Matching in Rust

Reading Time: 3 minutes Rust has an extremely powerful control flow operator called Match. Pattern matching in Rust works by checking if a place in memory matches a certain pattern. Patterns can be : literal values variable names wildcards, and many other things Destructuring using Pattern Matching Pattern matching can use to destruct following items : Structures Enums Tuples  Destructuring breaks up a value into its component pieces. The syntax used is Continue Reading

Generics : How to use them and Implement them in Rust

Reading Time: 4 minutes When we want to write code for multiple contexts we use Generics. It give us primitives to declare placeholder that allow us to focus less on the specific types. It allows us writing a more concise and clean code by reducing code-duplication and providing type-safety.  Generic Functions In a generic definition, we write the type parameter between open and close angle brackets after the name. In Rust, generic also describes anything that accepts one or more generic type Continue Reading

What are the different types of collection in Rust

Reading Time: 4 minutes Rust’s standard library includes a number of very useful data structures called collections. A collection is something that holds zero or more elements in some fashion that allows you to enumerate those elements, add or remove elements, find them and so forth. Rust’s collections can be grouped into four major categories: Sequences Maps Sets Misc Sequences Collection Sequences are supported in many forms in Rust. Vec Continue Reading

How Substrate Frame v2 different from Frame v1

Reading Time: 3 minutes Blockchain is a specific type of database. It differs from a typical database in the way it stores information. Blockchains store data in blocks that are then chained together. Blockchain has changed how we perceive problems. It has brought tons of benefits. Blockchain technology solves key issues like trust in a network. Blockchain technology utilizes advanced security compared to other platforms or record-keeping systems. By using Continue Reading

Let us Build Checkers, the Board Game in Rust

Reading Time: 4 minutes In my previous blog, you have seen how to build checkers game and implements its basic rules using WebAssembly. In this blog, we build Checkers game using Rust programming language. Let’s get started To get started, type the following in the terminal: Now rustycheckers the library project is created. Setting Up the Checkers Board To start writing the code to manage the game board, the Continue Reading

Let us Build Checkers, the Board Game in WebAssembly

Reading Time: 4 minutes Checkers is a fairly simple game played on an 8×8 game board. The board’s squares are typically alternating colours. Each player then places 12 pieces on the board in fixed squares spaced evenly one square apart from each other. So one Player controls black pieces another player controls white pieces. Lets us see what are some basic rules of the game :- The opponent with Continue Reading

Object Oriented Programming Concepts in Rust

Reading Time: 4 minutes Object Oriented Programming (OOPs) Concept Object Orientated programming is a methodology or paradigm to design a program using classes and objects. OOPs provides the following concepts: – Class and Objects Inheritance Encapsulation Polymorphism Abstraction There is a big debate about how many of these concepts a language needs to implement to be considered object-oriented. Today we gonna see how Rust implements these concepts to be Continue Reading

BABE – Consensus Algorithm and How to Implement it

Reading Time: 3 minutes What are consensus algorithms? Consensus means finding a way so people on a blockchain can reach a common agreement about the present state of the distributed ledger. Consensus algorithms make sure that all the nodes on the blockchain can reach a consensus over some computation. As a result, It will bring reliability to the blockchain network and establish trust among all the nodes in a Continue Reading