While Python will let you bundle a package with a call to a non existing function on an object (and error on run time), Rust won't let you compile the code. There are of course different categories of errors. We try some stuff and if it fails we either try to match it to an exception we accounted for (a planned one) or we don't match it and add it to a generic exception. In Python, this is usually done with try/except methods and raising exceptions.
So if you're as clever as you can be when you write it, how will you ever debug it?” - Brian W. “Everyone knows that debugging is twice as hard as writing a program in the first place. A big challenge in programming is that it's hard to account for all the possible errors that can happen in a program since we added those errors ourselves by simply writing the code. Let's face it, shit happens and it's important to be able to deal with things in a predictable manner.
RUST SQLITE EXAMPLE INSTALL
If you then copy that generated file to another place on your machine, or to another machine similar to yours (another M1 in my case), it will work too without having to install anything Rust related. It's also possible to run cargo build and then run the file located at target/debug/tutorial. So far it all looks very similar to what Python has to offer, except that the commands are run using cargo run instead of calling a specific file like python3 somefile.py.
RUST SQLITE EXAMPLE CODE
On M1 I can recommend Visual Studio Code with LLDB, it works pretty well and is ultimately better than constantly printing things out to stdout (to each their own though). It is also pretty much possible to use a regular debugger. I want to understand how my program is running and the first interaction with it is seeing what it's doing or what it has done through outputs to the command line. I recommend rust-analyzer as the only extension for VSCode.
RUST SQLITE EXAMPLE HOW TO
Now you can open that folder in your favourite text editor, I recommend VSCode if you're starting out as a few extensions that could help a lot and guides on how to use those extensions are very accessible. To verify that Rust has been installed correctly, create an empty project in an empty directory with: cargo new tutorial Everything should be configured and installed correctly. Run a single command in a terminal and you're good to go. This has been straightforward by following the examples on the Rust website. In some way, I'm more interested in complete dishes rather than the indexing of the ingredients properties.Įither way, I'd like to cover the basics before exploring more advanced topics. I'm only focused on using the language to get stuff done with minimum friction but also evaluating at which degree I can figure out stuff on my own in order to learn. Those pieces of content are excellent in explaining what Rust is but as a beginner I'm more focused in hitting the ground running as fast as possible. Rust is very different than Python and I won't elaborate on the technicalities that make Rust unique, there are many videos, articles and book written about the intricacies and technicalities of the language. I've recently joined a new company where one of the most used programming languages is Rust.Īfter using Python for almost a decade now, mostly for data engineering, I thought I'd give this new (to me) programming language a try and see if the praise I was reading about it on different platforms holds. How to do common programming tasks and how the tooling looks like. Trying out the Rust programming ecosystem as a 10+ years Python developer. Carefully exploring Rust as a Python developer