bestia-dev Tutorials for Rust programming language
Learning Rust and Wasm programming and having fun. I just love programming!
version 1.0 date: 2020-12-07 author: bestia.dev repository: GitHub
Hashtags: #rustlang #tutorial
My projects on GitHub are more like a tutorial than a finished product: bestia-dev tutorials.
Visit my web page: bestia.dev
youtube video tutorial
In my video tutorial series "bestia-dev Tutorials for Rust programming language" I explain how I use my development environment. You can see steps and processes that are not explained in README files.
Rust is a fantastic "new" language that has many benefits, but a steep learning curve.
Probably the knowledge of other languages and prior coding experience makes it even harder to learn. Our mind has already formed many patterns that are not "correct" for rust. It is difficult to lose an old habit.
I hope that new programmers will learn it as their first programming language. It can be much easier to understand and form correct patterns in the brain.
I am learning the language myself and I like to teach others, so I made my projects on Github more like a tutorial than a finished product.
A web page is the only true cross-platform application. It works on virtually any device or OS: windows, macOS, linux, android, iOS,...
But we are lucky that all browsers lately accepted the idea of wasm/webassembly. This enables different languages to be compiled into a very efficient
html5 + css for GUI
The worst part of cross-platform programming is the GUI (graphical user interface). It is a mess where every OS invented something different and incompatible. Some OS have even invented more than one GUI for themselves. It is interesting that in the end, all these GUIs look fairly similar.
The only true cross-platform GUI is HTML+CSS. It works in every browser on every platform. Just use it. It is sometimes more complicated and slower, but it works everywhere.
Having a web app made in html+css+rust-wasm sounds great. But it looks awful with all these browser toolbars and statusbar and it feels like a web page. It does not feel like a native app.
Enter PWA (progressive web applications)!
It allows the web app to be "installed" on your device and it feels like a native app. It has an app icon, it has some local storage, it works with or without a server connection, it updates automatically, and it does not have access to the local machine in a way to be potentially harmful. It works on all desktop and mobile OS. What is not to be liked?
Every local app deserves to have a web server somewhere to be truly usable.
Complex apps could download and upload data to the server.
But even the most simple PWA needs a web server to be run the first time and then maybe installed locally. The same web server is later used to update the PWA. This is the server of the original app author and not of some mirror or web store that could theoretically inject some adware/malware or tax all purchases. The web servers for PWA must use a secure HTTPS connection to avoid man-in-the-middle attacks. The TLS certificate also says a lot about the identity of the server owner. It feels a bit less frightening on this wild and dangerous internet.
Web servers are also needed for temporary caching of communication and to list users that are connected right now. I am talking about WebSocket and WebRTC technologies for communication over web standards.
Guess what? Rust is a great language for writing web servers, especially web servers for special needs, not just good old static web pages. Another name is maybe more appropriate here: web services or micro-services. But technologically it is the same thing, just more specialized.
On the server side, I will use PostgreSQL in a container. Inside the browser, there is the Indexeddb database.
Be aware that things are changing fast. It is possible that the same tutorial would be different if I write it today. But it is impossible to go back and update everything that changed. Probably in some later tutorial, I will address the change. Maybe. It is a complex ever-changing world. Use all the information having the date of writing in mind.
The first contact with the rust world is described in this project:
I need to teach about this great file manager:
https://github.com/bestia-dev/total_commander_best_file_manager A minimal example of PWA:
A more complex PWA:
Docker is nice to learn for easy publishing:
https://github.com/bestia-dev/docker_rust_minimal An example of a library/crate:
CLI examples (Command Line Interface) of how to manipulate text files:
Using rust CLI for shell scripting:
Finally a complex process of iterating over the programming of a simple game. Starting with a simple idea and changing it to a complex game version by version. Learning about modules, workspaces, documentation, task automation, wasm, PWA, web server, WebSocket, webRTC, tests, examples, split code into libraries,...:
Open-source and free as a beer
My open-source projects are free as a beer (MIT license).
I just love programming.
But I need also to drink. If you find my projects and tutorials helpful, please buy me a beer by donating to my PayPal.
You know the price of a beer in your local bar ;-)
So I can drink a free beer for your health :-)
Na zdravje! Alla salute! Prost! Nazdravlje!