Rust:- Generic – Declaring Function – Underscore Character ( _ )

Background Always my great bane is stealing code. Major kleptomania for me is unguarded code online.   Rust Get Type Name So like WrecksInEffect,  quite a number of weeks ago, I was wrecking into cars like I was at an amusement park with bumper cars.   std::any::type_name Enough knocking heads googled on how to get … Continue reading Rust:- Generic – Declaring Function – Underscore Character ( _ )

Rust:- Compilation – Error – “error[E0599]: no method named `write_fmt` found for mutable reference `&mut String` in the current scope”

Background Like often said on the streets, always behind that boy. Always, behind that girl. As for me, always behind that stolen code.   Code Sample rust-lang.org Formatln! = format! + platform specific newline XAMPPRocky Link Here is the code sample. Text Lab Work If curiosity gets to you, and you take that code to … Continue reading Rust:- Compilation – Error – “error[E0599]: no method named `write_fmt` found for mutable reference `&mut String` in the current scope”

Rust:- Compile Error – “error[E0382]: borrow of moved value”

Background Thankfully, Rust provides ample protection against attempting to access deallocated memory. Code Code Snippet Output Output - Text Output - Image Explanation Object Constructor let name = String.from("Angie"); Object Deallocate drop(name); Attempt to use deallocated Object Remediation Please comment out the original drop statement that precedes the println! from drop(name); to //drop(name);   Source … Continue reading Rust:- Compile Error – “error[E0382]: borrow of moved value”

Rust:- Component – List

Background Rust follows a traditional development lifecycle. The development train is a nightly build. In time, specific features in the nightly build are promoted to a beta build. Later, specific features in the beta build are promoted to a stable build. Once promoted to a stable build, the features are available to the general public. … Continue reading Rust:- Component – List

Rust Toolchain:- Error – “error[E0554]: `#![feature]` may not be used on the stable release channel”

Background One of the good sides of familiarising oneself with a new programming language is that as one is learning, other areas of the toolsets are being thought of. And, being built out.   Error Here is an error that I have been getting:- Image Textual Explanation The feature that we are trying to use … Continue reading Rust Toolchain:- Error – “error[E0554]: `#![feature]` may not be used on the stable release channel”

Rust:- Formatting Expressions

Background Let us share some of the formatting expressions that are supported in Rust.   Format Macros Macro Intent Example format! Emits output to a string let buffer:String; buffer = format!("{0} plus {1} equals {2}", 1,2, 1+2); write! Emits output to a file handle writeln! Emits output to a file handle and adds a new … Continue reading Rust:- Formatting Expressions

Rust:- Build Using Cargo

Background In Rust, one can build and target one of four profiles. The available profiles are dev, release, test, and bench. Cargo We will use Rust's Cargo tool to build. Commands clean build target dev release test bench Clean Outline Removes previously built artifacts. Syntax Sample Build Syntax Sample - Development Output Image Textual Sample … Continue reading Rust:- Build Using Cargo

Rust:- Formatted Output – Writeln! and Format! – Span Multiple Lines

Background In this post we will quickly cover how to span a string across multiple lines in Rust. We will employ the back slash ( \ ) at the end of each line that will be succeded.   Script Outline In Rust to span a string across multiple lines, please use the back slash at … Continue reading Rust:- Formatted Output – Writeln! and Format! – Span Multiple Lines

Rust:- Iterating a list iter().enumerate()

Background In time, you will need to build out a list.   Basic Steps The basic steps are the same:- Declare a list Initialize the list Add items to the list Display list items   Script Outline Create a list A list of fruits Declare variables i_plus_1:usize for loop Prepare Loop for (i, x) in … Continue reading Rust:- Iterating a list iter().enumerate()

Rust:- Build Warning – “crate should have a snake case name” – Project Rename & Binary Rename

Background Rust is really finicky in terms of naming convention. Lineage Rust:- Build Warning – “crate should have a snake case name” – Workaround – Ignore Date Posted:- 2022-September-15th Link Rust:- Build Warning – “crate should have a snake case name” – Project Rename Date Posted:- 2022-September-15th Link Error Message Image Text Troubleshooting Outline Project … Continue reading Rust:- Build Warning – “crate should have a snake case name” – Project Rename & Binary Rename