替换弃用的std::error::error::description的最简单方法


warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
error::Error::description(self)

这是否证明了整个Display impl样板的合理性,或者我可以放弃更简单的to_string()description中的哪些内容现在已被弃用(由于其简单性,我将非常怀念(?

添加Display实现;现在,错误就是这样发生的。

您可以使用thiserror派生宏库为您生成一个样板,并使用注释错误类型的字符串来最小化样板。

相关内容

最新更新