rustsyntax

What is the difference between <Type>::method() AND Type::method()?


In Rust, is there difference between <Type>::method() and Type::method()? Any easy way to see the differences?

For example, this rocket swagger code uses <String>::responses(...).


Solution

  • They mean the same thing. However, Type::method() can only be used when Type is also a path. Other types may require using < > like: