(Newbie) I am Just Completely Lost
I'll try and be as exact as I can below so I can actually get some real help, but the title says it best; I am just so lost when trying to learn Rust, coming from a background of Ruby, and Python. Any resource I read ends in frustration, because I can't follow along.
For example, I'm reading the official Book, and it says we're going to generate a number. We include a library, and will use it for random number generation. Okay cool, with you. Then it says this is how we use it:
rand::thread_rng().gen_range(1..=100);
What?
So rand is the library, crate, whatever, fine. Then thread_rng() is a method we call in that library, that we pass the results of to another method called gen_range(), which takes some arguments to use for the range we'd like to generate in.
I have questions.
First, the use of double colon early on in the chain. The best explanation I've found is that double colon is to say we're talking about the rand namespace, and the dots (which is what I'm used to) let's us call methods or fields in that namespace. I kind of get this, but can anyone expand further (or explain better?).
Next comes the chaining. Is gen_range() a method of rand, or thread_rng()? Or am is it something completely different.
Most importantly of all though; how can I figure any of this out from the documentation here?
I feel like there's some fundamental concept I'm failing to grasp, and it's making everything else impossible to understand.
Apologies for the desperate ranty sounding post, but much thanks if you've bothered to read this far and have guidance!