Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List all traits implemented by a type in a scope

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?

like image 316
user Avatar asked Nov 10 '22 23:11

user


1 Answers

Use rustdoc/cargo doc.

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

<code>Vec</code> example

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.

like image 51
mcarton Avatar answered Dec 19 '22 23:12

mcarton