如何在基板下链工人中使用十六进制::编码



我从链外工作者调用hex::encode,但编译失败,返回:

state.serialize_field("account_id", &hex::encode( self.account_id.encode().as_slice() ) )?;
|                                       ^^^^^^ not found in `hex`

我的货物.toml包含:

[features]
default = ['std']
std = [
...
'hex/std'
]
[dependencies]
hex = { version='0.4.3', default-features=false }

如何解决此问题?

添加;alloc";Cargo.toml的功能解决了问题:

hex = { version='0.4.3', default-features=false, features = ['alloc'] }

最新更新