Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

rust

traits

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

like image 704
dchiba Avatar asked Oct 30 '25 06:10

dchiba


1 Answers

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

like image 135
hellow Avatar answered Oct 31 '25 21:10

hellow



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!