小编mpl*_*pls的帖子

u8::from_be_bytes 和 u8::from_le_bytes 之间有有意义的区别吗?

由于大端和小端与字节顺序有关,并且由于一个u8是一个字节,所以不会u8::from_be_bytes并且u8::from_le_bytes总是具有相同的行为吗?

endianness rust

24
推荐指数
2
解决办法
3150
查看次数

Error::description 被软弃用是否意味着我必须重新编写当前的错误消息系统?

我注意到 Rust软弃用了Error::description. 建议使用Displayto_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)

string types rust

2
推荐指数
1
解决办法
407
查看次数

标签 统计

rust ×2

endianness ×1

string ×1

types ×1