What does double colon mean in Rust?

Viewed 634

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?

1 Answers

:: 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.

Related