and now after 3 months of head banging i am really starting to think that rust is not the type of language that be actually applied learning half or topic by topic
please recommend me correct way of learning rust and and where i can find exercises to practice learnt concepts , until now i am used to the idea of learning things on the fly but this method wont work with rust i guess
i cant learn thing without seeing its application and observing its working (rust by example doesn't work )
I would suggest the combination of an exhaustive Rust book (either the official one or Jim Blandy's Programming Rust) in order to make sure that you go through all the important concepts, and "Rust by Example" for extra code examples associated with many of these concepts that you can easily tweak and play around with.
As with all programming languages, it can also be useful to give yourself small thematic programming projects as you learn, in order to deepen your understanding of the new notions that you learn. But I'm not sure if someone has taken the time to collect a compendium of learning exercises like this, so you'll need to find your own.
Go through the books mentioned above and browse through the source code of any random crate you find on GH (preferably ones from the core team members).
Keep going - it will get easier. Took me a good 6 months before the fog started to clear, but I was coming from managed-only languages.
Don't beat yourself up over performance - clone things if you need to and use Rc-RefCell (or Arc-Mutex if multithreaded) where you need to have shared references - it's not cheating, it's just less efficient than plain references.
Pass arguments as references and return results by value makes things easier.
After a while some of the new-ness will wear off and you'll feel confident enough to explore more.
IRC-Driven-Development worked for me:
- Write a line of code.
- Copy'n'paste error message (until you "get" ownership and lifetimes every line of Rust will be an error ;)) to #rust-beginners IRC channel
- Helpful people will explain what's going on.
- GOTO 1.