dchiba
dchiba

Reputation: 193

How can I get a list of types that implement a particular trait in Rust?

I want to know a struct that implements std::io::Write; is it described in some document?

Upvotes: 4

Views: 3554

Answers (1)

hellow
hellow

Reputation: 13410

When you lookup the API for std you can search for your trait there (e.g. std::io::Write).

When you scroll down to the section "Implementors" you will see all structs/enums that implement that trait in std.

To get a better overview, you can use the + or - keys to collapse all sections and have a nice overview, e.g.

Write implementors overview

Upvotes: 11

Related Questions