我正在用铁锈写calculate_balance_changes函数。
但也有一些错误:
error[E0277]: the type `[Balance]` cannot be indexed by `String`
--> src/main.rs:126:30
|
126 | new_balances[input.address].coins.push(Coin {
| ^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Balance]>` is not implemented for `String`
= note: required for `Vec<Balance>` to implement `Index<String>`
error[E0277]: the type `[Balance]` cannot be indexed by `String`
--> src/main.rs:138:26
|
138 | new_balances[definition.issuer].coins.push(Coin {
| ^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Balance]>` is not implemented for `String`
= note: required for `Vec<Balance>` to implement `Index<String>`
error[E0277]: the type `[Balance]` cannot be indexed by `String`
--> src/main.rs:149:34
|
149 | if original_balances[input.address].coins
| ^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Balance]>` is not implemented for `String`
= note: required for `Vec<Balance>` to implement `Index<String>`
For more information about this error, try `rustc --explain E0277`.
warning: `rust-task` (bin "rust-task") generated 1 warning
error: could not compile `rust-task` due to 3 previous errors; 1 warning emitted
计算余额变化。