let x = Rust::from("Python");
A quick reference guide for the Pythonista in process of becoming a Rustacean.
A Rust guide for Python programmer/developer.
Mrs. Jalin: George.
Mr. Jalin: Yes, Gladys.
Mrs. Jalin: There's a man at the door with a moustache.
Mr. Jalin: Tell him I've already got one. (Mrs. Jalin hits him hard with a newspaper)
All right, all right. What's he want then?
Mrs. Jalin: He says do we want a documentary on crustaceans.
Mr. Jalin: Crustaceans!
Mrs. Jalin: Yes.
Mr. Jalin: What's he mean, crustaceans?
Mrs. Jalin: CRUSTACEANS!! GASTROPODS! LAMELLIBRANCHS! CEPHALOPODS!
...
Ok... watch it later... let's learn some Rust now...
- Getting Started with Rust
- Where to exercise
- Where to be informed on news and updates
- Interacting with Rustacean Communities
- Additional learning Resources
- Curious Facts
- Glossary of terms
- General fact comparison
- Environment Tools
- Libraries and Frameworks
- Applications
- Useful Crates
- Code Comparison
- Acknowledgement
Assuming you already know what is Rust and already decided to start learning it. Here are some steps for you to follow:
- Take a tour of Rust Syntax and Coding Style
https://learnxinyminutes.com/docs/rust/ - Watch some screencasts to get basics of Ownership &Borrowing concept
http://intorust.com/ - Follow this set of runnable examples to understand how everything fit together
https://doc.rust-lang.org/stable/rust-by-example/ - Now it is time to read your first book, you can pick:
-
Rust Essentials
A good introduction to Rust language in a more
superficial
approach which results in a very pleasant and easy reading, recommended even for those who are not experienced with low level systems languages.- Paparback and e-book available on Packt Publisher
https://www.packtpub.com/application-development/rust-essentials-second-edition
- Paparback and e-book available on Packt Publisher
-
TRPL (The Rust Programming language Book)
A complete Guide to Rust Language
https://doc.rust-lang.org/book/- Official Book
- Free to read online
- Available as paperback or e-book (buy at Amazon)
-
- Read some real examples
- Rust Cookbook
https://rust-lang-nursery.github.io/rust-cookbook/ This Rust Cookbook is a collection of simple examples that demonstrate good practices to accomplish common programming tasks, using the crates of the Rust ecosystem. - Anthology
https://github.com/brson/rust-anthology/blob/master/master-list.md
- Rust Cookbook
- Patterns and Good Practices
- Rust Patterns https://github.com/rust-unofficial/patterns
- API Guidelines https://rust-lang-nursery.github.io/api-guidelines/
Time to put your new knowledge in action solving some exercises.
-
Exercism.io
Register a new account on exercism.io (using github auth)
Install exercism command line client on your computer
Solve some exercises: https://www.exercism.io/languages/rust/ -
Rust Playground
Run Live Rust Code in the browser with https://play.rust-lang.org/ -
rustlings
Interactive rust exercises: https://github.com/rust-lang/rustlings
Now I assume you are addicted to Rust and you want to be updated about everything around it, here are some good links to follow.
- This Week in Rust Newsletter
https://this-week-in-rust.org/
https://twitter.com/thisweekinrust - Awesome Rust Newsletter
https://rust.libhunt.com/ - Reddit
http://reddit.com/r/rust (serious sub-reddit)
http://reddit.com/r/rustjerk (almost memes only) - Official Twitter
https://twitter.com/rustlang
Don't be afraid, the Rustaceans are a very receptive species and are cozy with the Pythonistas.
https://www.rust-lang.org/en-US/community.html
-
Brazil
- General
- Youtube : http://bit.ly/canalrustbr
- Telegram: https://t.me/rustlangbr
- Rust BH
- Rust in POA
- General
-
Indonesia
- General
- FB Groups (Rustaceans Indonesia) : https://fb.com/groups/RustaceansID
- FB Groups (Rust ID) : https://fb.com/groups/rustindo
- Telegram (Rust Indonesia) : https://t.me/rustindonesia
- General
-
Russia
- General
- FB Groups (RustyCrate) : https://facebook.com/rustycrate/
- Telegram (pro Rust) : https://t.me/proRust
- General
-
Add your country/city here, send a Pull Request.
- Learning Rust https://learning-rust.github.io/
- Rust Learning https://github.com/ctjhoa/rust-learning
- Rust Guidelines (WIP) https://aturon.github.io/
- Rust Design Patterns and Idioms https://github.com/rust-unofficial/patterns/
- Idiomatic Rust https://github.com/mre/idiomatic-rust
- GTK Rust Tutorial https://mmstick.github.io/gtkrs-tutorials/
- Effective use of iterators http://hermanradtke.com/2015/06/22/effectively-using-iterators-in-rust.html
- Red Hat Developers: Speed up Your Python with Rust https://developers.redhat.com/blog/2017/11/16/speed-python-using-rust/
- What's a reference in Rust? (The best article to understand
'lifetimes
and&
) https://jvns.ca/blog/2017/11/27/rust-ref/
- The language is named Rust because "rust is as close to the bare metal as you can get".,
in metal theory rust is the chemical layer closest to bare metal.
(also Wikipedia says that the name was possibly inspired by the name of a Fungi) - The Rust
trifecta
is 1) Memory Safe, 2) Fast 3) Concurrent - Rust can be used for web development http://www.arewewebyet.org/
- Rust can be used for Gaming Development http://arewegameyet.com/
- Rust can be used for Machine Learning http://www.arewelearningyet.com/
- Lots of IDEs and Editors supports Rust https://areweideyet.com/
(VSCode is known to have the better support by now https://marketplace.visualstudio.com/items?itemName=kalitaalexey.vscode-rust) - Rust packages are called
Crates
and are installed byCargo
explore them at http://crates.io - In Rust there is no Class but Structs, Enums, Traits, functions and macros!
- Rust compiler was first written in OCaml then rewritten in Rust! (Rust is written in Rust!!!)
- Rust type system is strongly inspired by Haskell
- Rust functional style is inspired by Erlang
- Rust type inference is mainly inspired by ML and also by Haskell
- The main syntax style is inspired by C and C++
- There is no automated Garbage Collector so Rust frees memory based on Resource Aquisition RAII (a.k.a Ownership)
- Rust has Generic Types!!!
- As Rust is close to bare metal you can ship a program without the inclusion of Rust's runtime which makes easy to distribute programs (no need of dependencies and virtuelenvs management)
- There are Python code in Rust! Rust build is bootstrapped by Python
- Graydon Hoare (creator of Rust) is now working at Apple developing the Swift language
- Rust is the developers most loved language according to Stack Overflow Survey
- Rust is the most energy efficient language! and that is very important for environment, data center companies and maybe it can help saving your laptop and phone battery in near future.
- There is an Operating System written in Rust - https://www.redox-os.org/
- Mozilla released the fastest version of Firefox (quantum) having many parts written on Rust
- The Rust mascot (unofficial) is called Ferris and it is a crab http://www.rustacean.net/
(There is no record of the official reason about being a crab, the reasonable history is that it was inspired by the Rusty Crab a common species of crab and also a name of a famous restaurant.) - To compliment your fellow Rustaceans don't say
cheers!. Say safe! (safe! is also said when toasting with champagne at Rust conferences) - Rust is to become a second programming language for the Linux kernel (see here)
More facts? and curiosities send a question here or send a Pull Request adding an interest fact to this list.
Term | Definition |
---|---|
crate | A rust distributable package |
ferris | The unofficial Crab Mascot |
Rustacean | The Rust programmer or evangelist or enthusiastic |
nightly | The unstable toolchain of the Rust compiler |
impl | Implementation |
Python | Definition | Rust |
---|---|---|
PEP8 | Guidelines and conventions | RustAPI Guidelines |
PEPS | Enhancement Proposals / RFC | Rust RFCs |
PSF | Organization / Foundation | Mozilla Research |
PyCon | Main Conference | RustConf |
Guido Van Rossum | Creator | Graydon Hoare |
1989 | First appeared | 2010 |
1991 | First Release | 2012 |
PSF | License | Apache 2.0 and MIT |
C | Implemented in | Rust |
.py, .pyw, .pyc | File Extensions | .rs, .rlib |
http://github.com/python/cpython | Repository | https://github.com/rust-lang/rust |
Pyladies, AfroPython | Diversity and Inclusion initiative | RustBridge |
comp.lang.Python | Official Users Forum | users.rust-lang.org |
Python | Definition | Rust |
---|---|---|
requirements.txt |
Official dependency tracker file | Cargo.toml |
setup.py |
Official installator / distributor file | Cargo.toml |
PyPI | Library repository | Crates.io |
pip | Library installation | Cargo |
setuptools and poetry | Library distribution | Cargo |
pbr | Library distribution | Cargo |
pipenv and poetry | Dependency manager | Cargo |
twine | Package uploader | Cargo and Semantic |
venv * |
Isolated environments | Cargo |
pyinstaller | Generate standalone executables | Cargo |
pyenv | Install and manage versions of language | rustup |
pydoc and sphinx | Generate documentation from code | rustdoc and Cargo |
python | Interpreter / Compiler | rustc and Cargo |
ipython | REPL | rusti |
ipdb | Debugger | rust-gdb |
Extending Python with C or C++ | Foreign language interface | PyO3 |
Python | Definition | Rust |
---|---|---|
urllib * |
HTTP calls | hyper |
requests | Simplified HTTP calls | reqwest |
json | JSON parsing loading and dumping | serde |
pyYAML | YAML parsing loading and dumping | serde |
lxml | XML parsing loading and dumping | RustyXML |
csv * |
CSV parsing | rust-csv |
datetime * & Dateutils |
Date & time | Chrono |
click and argparse | CLI Framework | clap |
docopt | CLI Framework | docopt |
re * |
Regular Expressions | regex |
subprocess * |
Run external commands | subprocess |
multiprocessing * |
Multiprocessing | Rayon |
logging * |
Logging | log |
Pathlib * |
Path manipulation | fs and fs_extra |
cryptography | Crytography | crypto |
pickle * |
Object serialization | RON |
heapq * |
Heap queue | BinaryHeap * |
bottle | Minimal web framework | Iron |
flask | Web framework | Rocket |
django | Full stack web framework | DO NOT EXIST YET |
SQL Alchemy | Relational database ORM | Diesel |
Pymongo | MongoDB driver | mongodb |
Jinja 2 | Template engine | Tera |
pygtk | GTk desktop development | gtk |
pyside | QT desktop development | rust-qt |
pygame | 2D UI library / gaming | ggez & Conrod & Piston |
unitest2 | Test framework | Builtin |
nose | Test runner | Cargo |
pytest | Testing framework and runner | Polish |
Flake8 | Linter | Clippy |
autopep8 and black | Auto formatter | rustfmt |
twisted | Network application framework | libpnet |
AsyncIO * |
Async application framework | Tokio and futures |
Pillow | Image manipulation | Image |
Beautiful Soup | HTML parser | html5ever |
Hypothesis | Data driven test framework | Quickcheck and proptest |
mock | Test mocking | Mockers |
bioPython | Bioinformathics libraries | Rust Bio |
Dynaconf | Config management | Config |
itertools * |
Data structure iteration | Rust Itertools |
Geopython | Geo spatial data | Geo Rust |
ScikitLearn | Machine learning | rusty-machine |
mistune | Markdown / Common Mark Parser | cmark |
celery | Distributed computation | Antimony |
boto | AWS clients | rusoto |
AstroPy | Astronomy | astro-rust |
Numpy | Numeric | ndarray |
Pandas | Dataframes | Polars |
Python | Definition | Rust |
---|---|---|
Pelican | Static Site generator | Cobalt |
ansible | Infra Orchestration | realize |
mkdocs | Generate documentation and e-books from Markdown | mdBook |
locust | HTTP load test | drill |
Nameko | Microservices Framework | fractalide |
Quokka CMS | CMS | Nickel CMS |
Add Pythonic features to Rust
Python | Definition | Rust |
---|---|---|
{'foo': "bar"} |
Syntax to create a dict / hashmap | maplit |
__init__(self, value='default') |
Instance initialization (with some default values) | derive_new |
itertools *stdlib |
Extra iterators methods | itertools |
hashlib * |
Password Hashing | libpasta |