如何获得在 Rust 中实现特定特征的类型列表? [英] How can I get a list of types that implement a particular trait in Rust?
本文介绍了如何获得在 Rust 中实现特定特征的类型列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道一个实现std::io::Write
的结构体;是在某个文件中描述的吗?
I want to know a struct that implements std::io::Write
; is it described in some document?
推荐答案
当您查找 API 时 APIcode>std 你可以在那里搜索你的特征(例如 std::io::Write
).
When you lookup the API for std
you can search for your trait there (e.g. std::io::Write
).
当您向下滚动到Implementors" 您将在 std
中看到实现该特征的所有结构体/枚举.
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.
这篇关于如何获得在 Rust 中实现特定特征的类型列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文