List all traits implemented by a type in a scope

北慕城南 提交于 2021-02-05 04:58:56

问题


For the sake of making debugging easier and such, I would like to know all traits implemented for a type within a certain scope. Can I get rustc to provide me this information? If so, how?


回答1:


Use rustdoc/cargo doc.

rustdoc creates a section with all trait implementations for a given type. For example with Vec:

If you would like to do this for your own crate, you might find --document-private-items to be useful. See also How to generate documentation for private items.



来源:https://stackoverflow.com/questions/26623243/list-all-traits-implemented-by-a-type-in-a-scope

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!