特征名称之后的特征是什么意思?
我在阅读有关Rust的特征定义时遇到了这个特征的定义:
trait Enchanter: std::fmt::Debug {
...
}
由此我了解该特征的名称是 nchanter
,但我不明白 std ::格式:debug
std ::格式>部分意味着它也是一个特征(我认为)。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是在宣布a supertrait 。它等同于:
简而言之,它需要任何想要实现
enchanter
的类型也可以实现std :: fmt :: debug
。否则,::This is declaring a supertrait. It is equivalent to:
In short, it requires any type that wants to implement
Enchanter
to also implementstd::fmt::Debug
. Otherwise, an error will be raised: