admin管理员组文章数量:1123042
In rust, is there difference between <Type>::mothod()
AND Type::method()
in Rust? How to simply implement some example to see easily the difference?
example: .rs#L33
- rocket swagger github sample
In rust, is there difference between <Type>::mothod()
AND Type::method()
in Rust? How to simply implement some example to see easily the difference?
example: https://github.com/GREsau/okapi/blob/d3bc6583dd828d37dc22f010ca8d51bfd1866a0a/rocket-okapi/src/response/responder_impls.rs#L33
- rocket swagger github sample
- Take a look: github.com/rust-lang/rust/issues/88799 . – Eugene Sh. Commented 2 hours ago
1 Answer
Reset to default 1They mean the same thing. However, Type::method()
can only be used when Type
is also a path. Other types may require using < >
like:
<[u8]>::method()
<&str>::method()
<(u8, u8)>::method()
<Vec<u8>>::method()
(thoughVec::<u8>::method()
does work too)
本文标签: syntaxDifference between ltTypegtmethod() AND Typemethod() in RustStack Overflow
版权声明:本文标题:syntax - Difference between <Type>::method() AND Type::method() in Rust - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736543097a1944411.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论