Rust is a strange language for some. However, it is a fun programming language to play (or work) with. When we need arrays in Rust, we declare and initialize an array simultaneously with size and default values. Declare And Initialize
Rust – How to create Two-Dimensional Array Example
An array is an important construct in most programming languages. This post shows how to create one- and two-dimensional arrays in Rust. Although Rust has different ways of creating arrays, the following examples demonstrate some of them. One-Dimensional Arrays Before
Rust – How to Create a List Using Vec, VecDeque, and LinkedList
In Rust, we may refer to any list as a sequence of items. A list can be fixed size like an array or resizeable collection types – Vec, VecDeque, and LinkedList. Meaning the list can grow or shrink at runtime.
Rust – How to Create While and For Loops
This post shows how to create and use loops in Rust. There are three ways to create loops in Rust – using the loop, while, and for keywords. The Endless Rust Loop Using the loop Keyword To create an endless loop
Rust – Display Contents of Array, Tuple, HashMap and Vector
When using collection types, we sometimes do not want to use loops to display each value. For example, in Rust, we can display the content of an Array, Tuple, HashMap (Map), or Vector without loops using the Debug trait. Rust
Rust – How to check if a String is Numeric
We always work with string values. In Rust, we can check if a string value is numeric or not using the function is_numeric() on a char value. That means we look at each character within a string. Rust Codes To
Rust – How to read last few lines of a File
Sometimes we don’t want to load read all the content of a text file. For instance, we only want to see the last several lines. In Rust, we can use a crate called rev_lines to read and display the last
Rust – Validate Email Address using Regular Expressions
This post about validating email addresses in Rust using the crate regex and regular expressions based on this other post.
ExecutorService, AutoCloseable, and Try-With-Resources In Java
This post demonstrates how to use Java ExecutorService and AutoCloseable with try-with-resources. With ExecutorService, we need to call the shutdown method all the time. However, call the shutdown method means we are writing more codes than we should. There has
Rust Selection Sort Recursion and Iteration
This post is about the sorting algorithm Selection Sort in Rust using recursion and iteration. Rust Selection Sort Using Recursion The sample Selection Sort codes in this post that use recursion have 3 functions. The first function bootstraps the recursive