Skip to content

Learning Rust and Wasm programming and having fun. I just love programming!

License

Notifications You must be signed in to change notification settings

bestia-dev/tutorials_rust_wasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

tutorial tutorials_rust_wasm

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 lang

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.

wasm/webassembly

A web page is the only true cross-platform application. It works on virtually any device or OS: windows, macOS, linux, android, iOS,... Every modern internet browser comes with a programmable engine. Sadly the only programming language of all browsers is javascript. Everybody knows it is a terrible language.
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 assembly code that works great inside the browser. Basically eliminates the need for javascript. The best language for wasm/webassembly is Rust.

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.

PWA

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?

web servers

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.

databases

On the server side, I will use PostgreSQL in a container. Inside the browser, there is the Indexeddb database.

let's start

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:
https://github.com/bestia-dev/rust01_the_beginning
Next:
https://github.com/bestia-dev/rust02_workspace_and_testing
I need to teach about this great file manager:
<<<<<<< HEAD https://github.com/CRUSTDE-ContainerizedRustDevEnv/total_commander_best_file_manager

https://github.com/bestia-dev/total_commander_best_file_manager

refs/remotes/origin/main A minimal example of PWA:
https://github.com/bestia-dev/rust_wasm_pwa_minimal_clock
A more complex PWA:
https://github.com/bestia-dev/rust_wasm_helper_for_pwa
https://github.com/bestia-dev/rust_regex_explanation_pwa
Docker is nice to learn for easy publishing:
https://github.com/bestia-dev/docker_rust_minimal
An example of a library/crate:
https://github.com/bestia-dev/reader_for_microxml
CLI examples (Command Line Interface) of how to manipulate text files:
https://github.com/bestia-dev/lmake_cargo_toml_to_md
https://github.com/bestia-dev/lmake_lines_of_code
https://github.com/bestia-dev/lmake_version_from_date
https://github.com/bestia-dev/lmake_semver
https://github.com/bestia-dev/lmake_md_to_doc_comments
Web server:
https://github.com/bestia-dev/cargo_crev_web
Using rust CLI for shell scripting:
https://github.com/bestia-dev/wsl_open_browser

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,...:
https://github.com/bestia-dev/mem1
https://github.com/bestia-dev/mem1_phonegap
https://github.com/bestia-dev/mem1_electron
https://github.com/bestia-dev/mem2
https://github.com/bestia-dev/mem2_server
https://github.com/bestia-dev/mem3_game
https://github.com/bestia-dev/mem4_game
https://github.com/bestia-dev/mem5_game
https://github.com/bestia-dev/mem6_game

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! 🍻

//bestia.dev
//github.com/bestia-dev
//bestiadev.substack.com
//youtube.com/@bestia-dev-tutorials

About

Learning Rust and Wasm programming and having fun. I just love programming!

Topics

Resources

License

Stars

Watchers

Forks