【发布时间】:2019-06-23 08:57:03
【问题描述】:
我想遍历一系列具有BigUint 类型的值(来自num crate)。
我该怎么做?
我试过了
for i in 0..a {...}
其中a 是(借用的)BigUint 类型。我收到关于不匹配整数类型的错误,所以我尝试了这个:
for i in Zero::zero()..a {...}
但我得到不同的错误取决于a 是否被借用。
如果a 是借用的,那么我会在错误中得到这个:
| for i in Zero::zero()..(a) {
| ^^^^^^^^^^ the trait `num::Zero` is not implemented for `&num::BigUint`
如果 a 没有被借用,那么这就是错误:
| for i in Zero::zero()..(a) {
| ^^^^^^^^^^^^^^^^^ the trait `std::iter::Step` is not implemented for `num::BigUint`
【问题讨论】:
标签: rust iterator ownership bignum