Modifying a C++ vector while iterating though itIt is interesting seeing how polarizing C++ is these days. There are people who love it, who are mostly C++ programmers with years of experience, but not exclusively: this group also includes some new C++ programmers who fell in love with it. On the ...Dec 21, 2025·5 min read
Mini version of ls implemented in RustFinally, we have all the elements we need to implement a mini version of ls command in Rust. Function main delegates to run. We do this in order to catch any errors and display a more user-friendly error message: fn main() { match run() { ...Oct 21, 2023·6 min read
Reading directory in RustIn this post, we work on the code that reads the contents of a directory. First, we get the path of the directory from a command line argument: let args: Vec<String> = env::args().collect(); if args.len() < 2 { eprintln!("Usage: readd...Oct 14, 2023·3 min read
Getting file informationIn this installment on our road to implementing a mini version of ls in Rust, we are going to get information about one file: Is it a regular file or a directory? File permissions Time of last modification Number of hard links That is the kind ...Oct 11, 2023·2 min read
Reading command line arguments with clapThis post is the first in a series that will develop a small rewrite of ls command with a small subset of features of the official Linux ls command. For a Rust implementation of ls that aspires to implement the full rewrite, take a look at coreutils....Oct 9, 2023·3 min read
Reading text filesThe topic of today's post is opening and reading text files. Simple stuff, and something that you can find described on countless pages, including Rust's official documentation. I am doing this one for my record. Reading the whole file with one funct...Oct 3, 2023·2 min read
Drop trait and Rust ownershipThis is something about Rust I find fascinating. It is about how the compiler manages to do the right thing. I'll explain what I mean, but first we have to prepare the scene. We will create a structure and implement Drop trait for it. Here's the stru...Sep 30, 2023·4 min read