Rust Programming: Creating a Phoronix Reader Application

This guide is no longer compatible with the current codebase and thus will be rewritten in the future.

This guide will present step-by-step instructions regarding how to write a Phoronix Reader command-line interface, or CLI, application in Rust with colored output, but will evolve to also include a GTK3 graphical user interface, or GUI. The goal of this project is to teach prospective programmers the skills they need to start writing complete software in Rust beyond the run-of-the-mill CLI calculator tutorials.

Before you can run by creating exquisite GUI applications, you must first learn to walk in creating CLI applications. GTK3 is a GUI toolkit used primarily on Linux for writing GUI applications. It stands for the GIMP ToolKit, even though GIMP isn't the focus of GTK anymore.

You will perform an HTTP request to download the homepage of Phoronix with hyper, parse the information with select and then print it in full color to the terminal using the term crate. Then, you will use the gtk crate to create a GUI window and widgets, gdk for handling keyboard input as well as coloring GTK3 widgets and the pango crate for manipulating text styles.

By the time you complete this tutorial, you should have a solid understanding of how to write applications in Rust using external libraries from Crates.io and GitHub, even without prior experience in programming. In the event that there is an area where you do not understand the material that well, feel free to send me a question and I will fix this tutorial to explain that portion in greater detail.

Screenshots

Command-Line Application

Screenshot of the CLI Application

GTK3 Graphical User Interface

Screenshot of the GUI Application

Source Code

The completed source code is available on GitHub at:

https://github.com/mmstick/phoronix-reader

You may clone the source code and compile it easily with git.

git clone https://github.com/mmstick/phoronix-reader
cd phoronix-reader
cargo run