{"id":36647165,"url":"https://github.com/bestia-dev/rust01_the_beginning","last_synced_at":"2026-01-12T10:01:50.005Z","repository":{"id":105012016,"uuid":"184524904","full_name":"bestia-dev/rust01_the_beginning","owner":"bestia-dev","description":"First steps for Rust development.","archived":false,"fork":false,"pushed_at":"2025-03-29T15:58:33.000Z","size":75,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-29T16:30:20.723Z","etag":null,"topics":["obsolete","tutorial"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bestia-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-02T05:16:43.000Z","updated_at":"2025-03-29T15:58:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"ecbfde9a-571e-40d5-8fe6-1756f0a7366b","html_url":"https://github.com/bestia-dev/rust01_the_beginning","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bestia-dev/rust01_the_beginning","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bestia-dev%2Frust01_the_beginning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bestia-dev%2Frust01_the_beginning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bestia-dev%2Frust01_the_beginning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bestia-dev%2Frust01_the_beginning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bestia-dev","download_url":"https://codeload.github.com/bestia-dev/rust01_the_beginning/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bestia-dev%2Frust01_the_beginning/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28337870,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T06:09:07.588Z","status":"ssl_error","status_checked_at":"2026-01-12T06:05:18.301Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["obsolete","tutorial"],"created_at":"2026-01-12T10:01:49.927Z","updated_at":"2026-01-12T10:01:49.998Z","avatar_url":"https://github.com/bestia-dev.png","language":"Rust","readme":"\u003c!-- markdownlint-disable MD041 --\u003e\n[//]: # (auto_md_to_doc_comments segment start A)\n\n# rust01_the_beginning  \n\n**First steps for Rust development.**  \n***version: 1.0  date: 2019-05-02 author: [bestia.dev](https://bestia.dev) repository: [GitHub](https://github.com/bestia-dev/rust01_the_beginning)***  \n\n ![obsolete](https://img.shields.io/badge/obsolete-red)\n ![tutorial](https://img.shields.io/badge/tutorial-yellow)\n ![License](https://img.shields.io/badge/license-MIT-blue.svg)\n ![rust01_the_beginning](https://bestia.dev/webpage_hit_counter/get_svg_image/967080871.svg)\n\nHashtags: #rustlang #tutorial  \nMy projects on Github are more like a tutorial than a finished product: [bestia-dev tutorials](https://github.com/bestia-dev/tutorials_rust_wasm).\n\n## OBSOLETE\n\nThis project is now 4 years old and it is obsolete.\nPlease follow this link to the updated version:\n\u003chttps://github.com/CRUSTDE-ContainerizedRustDevEnv\u003e\n\nThere is still some interesting information in this project, so I will not archive it. But I don't recommend to use it for working projects.\n\n## Description\n\nThe first project in Rust. How to install the toolchain and have a first result in 5 minutes.  \nThere is almost always a lot of different ways to achieve some result. I will describe only one option - for simplicity.  \nThe learning process is easier if it is simple. But the reality is always much much more complicated then that.  \nKnowledge must come in small drops to absorb it. If it is pouring it just confuses the curious mind.  \nThe \"book\" \u003chttps://doc.rust-lang.org/stable/book/\u003e is a great learning tool. The first chapters are really easy and practical and very well written. Use it.\n\n## Windows  \n\nI used Windows most of my long programmers life (33 years). It is still the number one desktop OS.  \nSo for developing desktop apps it is a good start to have the developer environment inside Windows.  \n\n1. Go to \u003chttps://www.rust-lang.org\u003e and choose `GET STARTED`.  \n2. Find the `RUSTUP-INI.EXE` (6MB) Download it.  \n3. Run it. Windows Defender will warn you that the app is unrecognized. Choose `More info` and `Run anyway`. Take your responsibilities!  \n4. Read the text in the console and answer with default choices. They are ok for the first time install.  \n5. If you don't have `Tools for Visual Studio 2019` for C++ installed on your machine, you will get a warning by the installer and instruction what to do.  \nFind the installation of C++ tools here and install it:  \n\u003chttps://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools\u0026rel=16\u003e  \nThe file name is something like `vs_buildtools__1788641612.1545772962.exe`.  \nIt downloads the true installer with a graphical user interface.  \nYou have to choose \n- `C++ build tools` on the left \n- and then the latest `Windows 10 SDK xxx` on the right.  \nIt will download (1.2 GB) and then install (4.4 GB).  \nProbably now you have to restart your PC.  \nGOTO step 3.  \n6. Rustup will download and install a number of tools and documentation. Be patient with the docs, they take a looong time. There is a big discussion in the Rust community to not install them by default and let the user choose them later. But now we have what we have.  \n  \nThat's it. Rust is installed. Super simple (except for the C++ tools).  \n  \n## The first project\n\nPress `window + s` (`window` is this strange key on the keyboard in the first row near `ctrl` and `alt`) it opens the start menu.  \nStart typing `command prompt` it will suggest you exactly that and press Enter to run it.  \nYou should be inside your user folder. For me it is `C:\\Users\\Luciano`.  \nI created a folder with the name all small caps `/rustprojects` inside my user folder.  \nIn Windows file/folder names are not case sensitive, but in Linux they are very sensitive. Be careful.  \n\n```bash\nmkdir rustprojects\n```  \n\n```bash\ncd rustprojects\n```  \n\nWe will create a new rust project with this simple command  \n\n```bash\ncargo new first_hello\n```  \n\n```bash\ncd first_hello\n```  \n\nYou probably already know that you can type just `cd f` and then press the Tab key multiple times to get suggestions of subfolders name starting with `f`.  \nIf not, try it. It works great.  \n  \nFor most of the commands it is really important in what folder you run them. Now you should be inside the `c:\\users\\Luciano\\rustprojects\\first_hello` folder (with your username and not mine).  \nLet build the project and run it:  \n\n```bash\ncargo run\n```  \n\nCongratulations! You wrote your first working rust project.  \n  \nI am sure you want to try this again one more time.  \nPress the `arrow up`. The command prompt will suggest the last typed command from history. In this moment it is `cargo run`. Run it by pressing Enter.  \nThis history stuff with `arrow up` and `arrow down` is super useful, because you will repeat the same commands a lot.  \nThis time the compilation is really fast, because there is nothing new to compile.  \n\n## VSCode\n\nNow you want to see and change the code. I choose the open-source editor VSCode.  \nDownload it and install it from here \u003chttps://code.visualstudio.com/\u003e  \nRun it and add a VSCode extensions for rust `Ctrl + Shift + X`: Rust (rls)\n  \nOpen your project with  \n`File - Open Folder... - c:\\users\\Luciano\\rustprojects\\first_hello`  \nUse your username here instead of mine.  \nSimple Rust projects are basically just a folder. There is a convention of subfolders names and it works just that simple. You will find your code in the `src` subfolder in the file `main.rs`.  \nChange the word `Hello` into `First Hello` and save it with `Ctrl + s`.  \nYou already know from before how to build and run it. Give it a try and show what you have learned.  \n\n## Git\n\nGit is a great tool and you should use it for code versioning. Use it often and group the changes so that is easy to understand what a commit really changes.  \nVSCode it totally prepared for it. I am not sure if you need to install it manually or VSCode makes all in its installation. You will quickly find out.  \nThe third icon on the left or `Ctrl + Shift + g` opens a simple list: what has changed. You write a `Message` and press `Ctrl + Enter` to commit.  \nIf you want to see the changes you select a filename. The changes will show on the right.  \nYou can also use it to push or sync the changes on GitHub and much more. Then there is a specific `.gitignore` file for rust source code. This is advanced stuff. You will learn it step by step.  \n\n## WSL Windows subsystem for Linux\n\nMost of the servers in the world today are Linux. So you want a Linux environment to develop for Linux servers. It is possible now to use WSL `Windows subsystem for Linux` inside your Windows machine. It feels just like Linux for almost everything you'll need. It is like having a virtual machine, but a little bit simpler.  \nHere is how to enable it and install it:  \n\u003chttps://docs.microsoft.com/en-us/windows/wsl/install-win10\u003e  \nI choose the Debian GNU/Linux distro. Old school.  \nFrom WSL Linux you can use the files in Windows. But from Windows you cannot use files in WSL Linux. I want my `/rustprojects` files to be accessible from both OS.  \nI create a symlink in WSL to the `/rustprojects` folder  \n`ln -s /mnt/c/Users/Luciano/rustprojects ~/rustprojects`  \nNow when I start Debian I am in my home user folder `~`  \n`luciano@MyMachine2015:~$`  \nand I can command  \n`cd rustprojects`  \nI am now inside the same `/rustprojects` folder as in Windows.  \nThe Linux bash (console) has also suggestions for subfolder names if you type `cd r` and then Tab key, but it is not so user friendly as in windows. It has also the command history with `arrow up` and `arrow down`. That is great because it remembers also the old commands from old sessions.  \n  \nInstalling rust on Linux is simple:  \n\n```bash\ncurl https://sh.rustup.rs -sSf | sh\n```  \n\nYou will find this info in the \"book\": https://doc.rust-lang.org/stable/book/  \n  \nGo to the folder /first_hello  \n\n```bash\ncd first_hello\n```  \n\nand build and run the project  \n\n```bash\ncargo run\n```  \n\nCongratulations! The same project now works in Windows and also on Linux.  \n  \nThe result is in the `/target` folder. Normally the windows file ends with `.exe` like `first_hello.exe`, but the Linux file has no extension like `first_hello`.  \nIf you build a project in Linux the result will be for Linux. And if you build it in Windows, the result will be for Windows. The results are binary incompatible.  \n  \nYou can still use the Windows VSCode for editing the source code and windows Git for versioning. You then use the Debian bash just to build it and run it.  \n\n## For the curious TL;DR;  \n\nThe user home folder is called `~` in Linux and mostly `%HOMEPATH%` in Windows.  \nWindows can very often understand both \\ and / as folder delimiters, but not always. In Linux there is only /. So it is smart to learn to user / everywhere where it works.  \nLinux file/folder names are very very case sensitive, windows are case insensitive. That can make a lot of confusion. Try to write always small caps names if it is possible. And try to avoid spaces and strange characters. Underscore is very well understood in every situation, I recommend it.  \n\n## Next projects\n\n\u003chttps://github.com/bestia-dev/rust02_workspace_and_testing\u003e\n\n## References\n\n\u003chttps://doc.rust-lang.org/stable/book/\u003e  \n\n## Open-source and free as a beer\n\nMy open-source projects are free as a beer (MIT license).  \nI just love programming.  \nBut I need also to drink. If you find my projects and tutorials helpful, please buy me a beer by donating to my [PayPal](https://paypal.me/LucianoBestia).  \nYou know the price of a beer in your local bar ;-)  \nSo I can drink a free beer for your health :-)  \n[Na zdravje!](https://translate.google.com/?hl=en\u0026sl=sl\u0026tl=en\u0026text=Na%20zdravje\u0026op=translate) [Alla salute!](https://dictionary.cambridge.org/dictionary/italian-english/alla-salute) [Prost!](https://dictionary.cambridge.org/dictionary/german-english/prost) [Nazdravlje!](https://matadornetwork.com/nights/how-to-say-cheers-in-50-languages/) 🍻\n\n[//bestia.dev](https://bestia.dev)  \n[//github.com/bestia-dev](https://github.com/bestia-dev)  \n[//bestiadev.substack.com](https://bestiadev.substack.com)  \n[//youtube.com/@bestia-dev-tutorials](https://youtube.com/@bestia-dev-tutorials)  \n\n[//]: # (auto_md_to_doc_comments segment end A)\n","funding_links":["https://paypal.me/LucianoBestia"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbestia-dev%2Frust01_the_beginning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbestia-dev%2Frust01_the_beginning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbestia-dev%2Frust01_the_beginning/lists"}