我正在尝试在外部参数声明中使用以下结构:
pub struct PriceUpdate {
pub source_currency: Vec<u8>,
pub target_currency: Vec<u8>,
pub provider: Vec<u8>,
pub price: i64,
}
这是外部声明:
pub fn new_price(origin: OriginFor<T>, price_update: PriceUpdate) -> DispatchResult {
这会导致编译错误:
^^^^^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `PriceUpdate`
有人可以解释对于复杂类型(例如结构/vecs/vecs 的结构/等)的外部参数的要求是什么?我看过 WrapperTypeEncode 文档https://docs.rs/parity-scale-codec/2.2.0/parity_scale_codec/trait.WrapperTypeEncode.html但他们没有拼出这些信息。
非常感谢!