问题
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