【发布时间】:2021-10-06 14:50:14
【问题描述】:
#![cfg_attr(not(feature = "std"), no_std)]
use ink_lang as ink;
#[ink::contract]
mod XYZ {
#[ink(storage)]
pub struct Xyz {
token_id: u32,
serial_code: String
}
...
}
错误:
serial_code: String
| ^^^^^^ not found in this scope
【问题讨论】:
-
你明确排除 std 有什么原因吗?
-
String 不是 Substrate 和 Ink 环境的一部分,因为它会增加二进制/编译后的大小(可能是因为 UTF8 处理)。如果需要,请使用
Vec<u8>存储此类数据。