I am struggling with rust because i cant see WHEN i need to use N thing.
I have coded rust for a couple of years now and i can build small programs, cmd programs etc etc. Things that are simple and pretty straight forward. But i always leave rust after a while because i struggle when it comes to writing something more advanced.
I often try to read other projects source code to understand more complicated/advanced concepts, but when coding myself i cant see when i need to use rust feature N, to solve something, or when to use rust datatype Y, or pattern X etc.
For example, Box::leak, i know exactly what it does since i have read and understood the docs for it. It basically leaks the memory, meaning the memory will never be deallocated, it will be a reference with a static lifetime. I have read the docs, but i have never used it. I dont know when to use it, i just can't see it.
The same goes for things like Arc::downgrade. I know what it does, i know that it gives me a reference that does not count towards de-allocation. But i cant see a scenario to when i should use it?
I see so many people writing so much complicated, advanced things. Im so impressed but also sad since i feel like i can't see what other see. I tried writing a connection pool, to be able to learn more concurrent programming, but i just got stuck and then ended the project.
And that's how most of my advanced attempts end up, i start writing something, i get stuck, i struggle and then i give up.
Worst is when i spend several hours. days or weeks on something and then i get stuck with some borrow checker problem, or some other problem and i need to rewrite half the application to solve that. Even after 3 years of Rust coding.
Most docs, tutorials explain the concepts word for word of what the official docs say (which are amazing, no complaints there) but very few tutorials expect for like Jon Gjengset that actually builds somethings, and shows how certain things work, and specific scenarios as to WHEN to use certain things.
An example there is Cow<T>, i understand the entire concept of it, allocate or not allocate, but i struggled to see when i would need to use it, until John showed a couple of scenarios of when it is useful.
Is there anyone out there struggling like me? or am i alone and should just give up rust?
(im from a Java background, but i have done C, and C++ in uni several years ago, and i have probably written about 30 different projects in rust of various smaller kind)