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

你说的曾经没有我的故事 提交于 2020-01-04 04:09:08

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/55216559/how-can-i-get-a-list-of-types-that-implement-a-particular-trait-in-rust

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