Anatomy of a Rust Program, Part IV: /src/helperror.rs

This blog post is the fourth in a series that describes the structure of the wink command line program that I have written in rust and that I use to invoke other Windows and Linux programs from bash and Windows shells under Windows Subsystem for Linux. This post describes the HelpError struct used to indicateContinue reading “Anatomy of a Rust Program, Part IV: /src/helperror.rs”

Anatomy of a Rust Program, Part III: /src/lib.rs

This blog post is the third in a series that describes the structure of the wink command line program that I have written in rust and that I use to invoke other Windows and Linux programs from bash and Windows shells under Windows Subsystem for Linux. This post describes the components defined in the /src/lib.rsContinue reading “Anatomy of a Rust Program, Part III: /src/lib.rs”

Anatomy of a Rust Program, Part II: The main() Function in /src/main.rs

This blog post is the second in a series that describes the structure of the wink command line program that I have written in rust and that I use to invoke other Windows and Linux programs from bash and Windows shells under Windows Subsystem for Linux. This post describes the main() function in the /src/main.rsContinue reading “Anatomy of a Rust Program, Part II: The main() Function in /src/main.rs”

Anatomy of a Rust Program, Part I: Wink cargo.toml

This series of blog posts describe the structure of the wink command line program that I have written in rust and that I use to invoke other Windows and Linux programs from bash and Windows shells under Windows Subsystem for Linux. Especially as rust is well-documented and uses constructs much like many other languages, myContinue reading “Anatomy of a Rust Program, Part I: Wink cargo.toml”

Quick Notes on Mutable and Immutable Variables in Rust

This blog post contains some notes about mutable and immutable variables in the rust programming language. Rust supports both mutable and immutable variables. Mutable variables are typical of all programming languages: they hold values that can change. Variables are immutable by default. Immutable variables can hold values that cannot change, but they are not theContinue reading “Quick Notes on Mutable and Immutable Variables in Rust”

Resolving Rust error[E0308] Mismatched Types When Types Actually Match

This blog post explains one possible solution for rust compilation error E0308, mismatched types, when the referenced types actually match. I was getting this compilation error: error[E0308]: mismatched types –> src/main.rs:46:13 | 46 | category_list.categories, | ^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `wink::wsl::inv::invocablecategory::InvocableCategory`, found struct `InvocableCategory` | = note: expected struct `Vec<wink::wsl::inv::invocablecategory::InvocableCategory>` found struct `Vec<InvocableCategory>` My project structureContinue reading “Resolving Rust error[E0308] Mismatched Types When Types Actually Match”

Rust Warning: Cargo Test Passes Its Command Line Arguments to Your (Test) Programs

This blog post describes an issue that you may face using cargo to test rust programs that parse command line arguments. I used something like the following command line to invoke rusts tests for some logic that parses command line arguments. cargo test -v –workspace –all-features –target-dir $linbld — –nocapture — -epdv word a bContinue reading “Rust Warning: Cargo Test Passes Its Command Line Arguments to Your (Test) Programs”

Implement the Rust Display Trait to Render Structs as JSON

Sometimes we just want a simple technique to list the values of an object for logging, diagnostic, debugging, or other purposes. Serializing to JSON with the Display trait may not be comprehensive or consider all cases (for example, some values may require greater security), but could be one of the easiest possible approaches for developersContinue reading “Implement the Rust Display Trait to Render Structs as JSON”

Simple Case and Solution for Borrowing a Moved Value in Rust

I was refactoring some code to move command-line parsing logic from /main.rs into /lib.rs and I ran into a compilation error that has a very solution that demonstrates some of the concepts and issues with ownership and borrowing in rust and how easy it can be to work around some of them, though not always.Continue reading “Simple Case and Solution for Borrowing a Moved Value in Rust”

Orienting to Programming with Rust

This blog post intends to provide guidance that may assist developers familiar with common web programming technologies such as ASP.NET and JavaScript to learn the rust programming language. I am going to try to list the little things that I had to learn before I could do anything correctly with rust. This post does notContinue reading “Orienting to Programming with Rust”