I'm completely new to Rust programming language. While studying this lesson, I kind of didn't understand the following two lines.
let mut guess = String::new();
and,
io::stdin()
What is the use of double colon in both cases?
I'm completely new to Rust programming language. While studying this lesson, I kind of didn't understand the following two lines.
let mut guess = String::new();
and,
io::stdin()
What is the use of double colon in both cases?
:: behaves like a namespace accessor. You can navigate through modules or specify locations like std::io::stdin() or call methods for objects like in String::new(). It can even be mixed, since an object may be in a module itself, so for example, the full path to the String new method would be std::string::String::new.
Refer here for more information.