quester
quester

Reputation: 564

in Rust when you would type function::<type>()?

in Rocket documentation I found this construction

request.guard::<&State<MyConfig>>().await

I understand await and & but this func::<type>() part is completely different from what I have seen in other mainstream languages func() like C++, C#, Java, python... probably best answer would be to point me to the right reading material about it because it's not framework specific

Upvotes: 1

Views: 131

Answers (1)

HTGAzureX1212
HTGAzureX1212

Reputation: 64

It is called the turbofish, and is used for generics - and sometimes used when the Rust compiler cannot infer the type of some variable, for specifying the concrete type of that variable.

See non-operator symbols on the Rust Book for more information.

Upvotes: 5

Related Questions