基板开发人员可能会遇到的一个常见问题是:开发自定义托盘以将映射存储到具有常见类型的存储中,例如String. 举个例子:
#[derive(Encode, Decode, Clone, Default, RuntimeDebug)]
pub struct ClusterMetadata {
ip_address: String,
namespace: String,
whitelisted_ips: String,
}
Run Code Online (Sandbox Code Playgroud)
在构建运行时,您会收到每个错误String:
|
21 | ip_address: String,
| ^^^^^^ not found in this scope
Run Code Online (Sandbox Code Playgroud)
Strings不包括在范围内?和其他std锈类型?当我yarn在包含带有字段的 package.json 文件的目录中运行时"private": "true",,此行将被静默删除。例如,yarn 3.1.0 中有此行为,但 npm 8.5.5 中没有此行为。