A new programming Language (well I stumbled on this about 5 years after release) with some new Concepts which stand out from other system languages such as C, C++ and Go.
After some research, the rust-book seems like the best starting point. Even if you are not interested in learning a new Programming Language, I would still recommend to read through or even get your hands a little bit dirty, since it gives a different angle in programming in General and the book is also pleasant to read.
Halfway through the book until Chapter 12. I decided to apply the learning's in a small MTGA reader.
After I went through the Rust book, learned about the rust eco system and doing the rustlings tutorial, I figured that I should start with a little sample project.
At the time I played MTGA and wanted to do something with its card data. After a little digging for a solid database in the net, I stumbled into the Install folder of the game on my Computer. I found many data files, which contained the card data in JSON format. I would have to look up the title of the card data and map it to the correct value in the location json. Also, abilities and their names are represented by ID's, many Key-Value Pairs I will have to map.
The data was spread around the files, because of location data. But I am only interested in seeing the actual card as some sort of object in a Single database.
I would have to reverse engineer Data objects, which apparently are exported out of some kind Content Management System. This simple meta data should be parsed in csv, json or whatever.
I guess this is a simple enough concept to get the basics out of the Rust programming Language with the Help of my favorite Game at the Time.
Luckily, the Rust book got a section where we had to build a simple console application, other than that we will need some json parsing.
Let us get started:
I started by building my Data Objects with help of https://app.quicktype.io/ , paste your object and create data models out of it. With help of the rust-book I slowly but steadily I started to map the data to my desired output object. I got started with creating structs and their impl(ementation), how to handle list structures and how to test it all! Basically, I implemented the learnings I had of the book and their learning path into my own Project, which I recommend everyone to do.
The project is committed on github, and it is far from complete and correct. Still I was able to get the basic concepts of this awesome language done.
For me the main challenges of Rust are to get my head around Option, Result and with these, the Error handling. Error_chain is recommended by the Rust community. The second challenge is to really understand how Rust is using memory, heap and stack. They call it borrowing. I cannot speak for Go, C++ or C in regards of memory management, but I really like the concept Rust is proposing, less Errors created by me and no null reference errors.
I would recommend the Visual Studio Code Rust extension, which shows you compiler errors and warnings. I saved a lot of time fixing these Errors before I even started building the project.
I will not go into Detail how to get started and what to do with the language, but I like to share my opinion and a few Links follow my journey.
That is, it my friends, thanks for reading.
(Links will follow)