我注意到 Rust软弃用了Error::description. 建议使用Display或to_string()获取我的错误描述,但这是否意味着我必须重新编写当前的错误消息系统来处理String而不是&str?
我正在使用此代码,并且我注意到野外的代码看起来很相似:
fn description(&self) -> &str {
match *self {
Error::CannotDeriveFromHardenedKey => "cannot derive hardened key from public key",
Error::Ecdsa(ref e) => error::Error::description(e),
Error::RngError(_) => "rng error",
Error::MnemonicError(_) => "mnemonic error",
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
407 次 |
| 最近记录: |