Rust Language – A starter

Rust Language – A starter

After years and years of working in C++, Rust has been a breath of fresh air. Though, some of the things that had been taken for granted in when writing applications in C++, is now needed to be throw out the window. It all started with writing functionally safe code for my work. I was recommended to write the application in rust to address security concerns at compile time and, on trying, I immediately got hooked.

Knowing when Typing

One of the most useful aspects of rust is that unlike C++, I get to have a better and tighter typing facilitation. Rust Programs managed using cargo links with LLVM daemon to compile code on the file. That combined with VS code integration adds for writing bug free code from start. By the time I start to compile my code, am strictly aware that there wont be any issue for most synchronous operations.

I already know my dead code, unused variables and anything that would affect my code quality. A good programmer would tend to reduce dead code and rust enables you to do it. From what I have seen rust + cargo + vs code might be my ultimate set for rapid prototyping tools. It barely takes a few minutes to get off the ground and start flying, I agree python is there, but you can’t compare python to a system’s programming language that runs natively as an executable.

Crates and Crates, Crates Everywhere!

One of the worst nightmares of any software development process is dependency management. In C and C++, I have mostly survived using git along with self written makefiles. But, the bigger the project, the bigger is the dependency management nightmare. Cargo for rust, solved this for me and incredibly shortened my work. Cargo handles these dependencies elegantly and make my nighmare go away with a few simple commands. There is maven and gradle, but the XMLs make it all thoe more complicated. TOML is the new format that saves the day for you.

These dependencies are packaged in the form of “.creates” similar to how you end up having jar files in Java or py files in python. They are publised at https://crates.io/. You simply go search them copy the commands you need to add a crate to your project and then, you have what you need to do your work!

You simple add your crate using cargo add tokio to add tokio library to your project for use.

You can see the entries in the Cargo.toml file and start with integrating it. You can also select specific versions of a crate to freeze your code and that works as well.

Projects!

I am so hooked onto rust that I started doing projects every other week, committing, testing and pushing content. Here are some of the stuff which I have published so far:

Rust User Management

A simple user management tool that works command line and tries to save user data to a postgress database. The user can perform all basic operations from command line.

Meteo Wizard (Work In Progres)

A rust based weather application which uses Open-Meteo API.

  • Can geolocate based on IP/Latitude-Longitude and Zip Code
  • Provides for a configurable way to get weather data (Select the data you need and the duration for it)
  • UI components are yet to be worked out but mostly its promising

A few more projects are on the way but I will keep updating the progress of them…