Hi all, absolutely new to Rust. Got into it after a lot of friends suggested (read: forced) me to check it out.
I'm in sort of a weird position, though. I have former experience in C# and Python, but most if not all of my programming experience has been in controlled frameworks or environments (for example, my C# experience is like 99% Unity3D dev) or in the case of Python, I've used it more as a tool to solve a particular problem statement without regard for speed or memory. Kind of a bad look, I guess.
However, Rust is kind of a blank slate for me. I don't have any particular problem I'm looking to solve that Rust does better, and all the articles on "why you should learn Rust" mention things like memory management or faster compile times; things that I've either never had to deal with myself or I didn't have to care about.
With that said, what should my approach to Rust be as someone who's mostly worked in the safety (and confines) of predefined frameworks?
I would really recommend reaching out on the forum or other community channels if you have trouble with something or even sometimes to have a look at something that does work, to review and point you in the right direction. There are a lot of really helpful people over here who are glad to help.
Rust is very good at keeping you from doing things with disastrous consequences, so while you are safe from memory errors with Rust, you are not safe from frustration ( definitely read that link when you run into such ) with what it tells you you aren't allowed to do. Getting another person to look at your code can really help when that happens.
They way everybody learns is different. The options on the rust website for learning, i.e. the book, and a couple example-based courses, are a good start.
Also, if you have something that you think would be interesting, useful, or fun that you want to start to try to make, maybe just give a shout-out on the forum to ask for pointers on where you might want to start.
Pretty much the same approach as any other language.
This is a bit of a problem as now there are whole areas of the Rust book I have not explored, having diverted time into actually using Rust for real work. And hence a lot of Rust language features I'm unaware of. So my code is probably not as "idiomatic" Rust as it should be and most likely not done in the best way. Still, it's all been up and running reliably for months now I must make time for more serious Rust study at some point.
In short: Just get started. When you get stuck the folks here are very tolerant of dumb newbie questions and very helpful. Rust is a very rewarding exercise.
@ActuallyAcey - also worth noting that since you're coming from Unity, you're probably aware of their shift toward DOTS (data oriented technology stack) which includes things like safe threading via Jobs and data alignment via ECS
Rust is (among other things) inherently thinking and solving things in the same space, e.g. "how do we provide abstractions that are safe but as fast as possible" - so I think it's a pretty good time to delve into it even if you want to get a better understanding of how/why Unity needs to do this in order to stay competitive.
Most people reference documents like The Book, but while it's a really good resource I prefer a more hands-on approach to learning. So instead I'll start a project and learn new things when I need them.
My go-to project for getting familiar with a new language is to write a parser and interpreter for a lisp-like programming language. I like it as a project because it gives you a good mixture of data structures, parsing and string processing, tree operations. It also feels a lot more satisfying than the contrived examples you'll encounter in a book.
Another useful way to experiment with the language is using existing programming problems like Project Euler or Exercism.
Rust is actually really good for this sort of thing! For example, at work I'm using Rust to automate things like our release process (it's complicated), to generate pretty reports that non-programmers can use to get an overview of recent changes, and for processing data recorded while troubleshooting.
I'd definitely recommend trying to rewrite some of your existing Python tools in Rust. It'll be a useful experience, have actual effects on your productivity, and will introduce you to libraries like clap and structopt (command-line argument parsing), serde (serialization), and regex (regex) which are the gold standard in their respective fields.
Don't forget to post questions on the user forum when you get stuck, people are really nice and happy to point you in the right direction. Bonus points if you can provide examples and what you're expecting to happen so we can streamline the troubleshooting process.
You can also read through existing threads to learn more about the language or pick up best practices.
It's quite common to hit a wall early on when transitioning from garbage collected languages because you now need to worry about "lifetimes" (i.e. who owns what and how long is an object alive for). If this happens don't stress or beat yourself up, object lifetimes are a programming concept that never get explicitly taught elsewhere. Regardless of whether that's in a GC'd language (the GC looks after it for you) or a normal systems language like C or C++ (you learn after spending many hours troubleshooting random crashes and undefined behaviour).
Thank you all so much for the advice! I'd personally want to mark Micheal's answer since it feels the most spot on for what I'm exactly looking for. I hope to keep you all updated when I get down to business!