rust - 不稳定库功能 "core"问题的解决方法是什么?

标签 rust biginteger

我正在尝试在 Rust 中将大整数相加:

extern crate core;
use core::ops::Add;
use num::bigint::{BigInt};
use num::integer::Integer;
...
let mut big = "8705702225074732811211966512111".parse::<BigInt>().unwrap();
let one = "1".parse::<BigInt>().unwrap();
big = big.add(&one);

我收到以下错误:

src\main.rs:3:1: 3:19 error: use of unstable library feature 'core': the libcore library has not yet been scrutinized for stabilization in terms of structure and naming (see issue #27701)
src\main.rs:3 extern crate core;

目前有什么解决方法吗?或者这暂时完全不可行?

最佳答案

您应该能够使用 std::ops::Add trait 而不是 core::ops::Add

use std::ops::Add;

关于rust - 不稳定库功能 "core"问题的解决方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34756799/

相关文章:

rust - 当库名称与包名称不同时如何导入 crate 依赖项?

c++ - Rust 中指针和引用的区别

java - 使用 gson 将 Java 对象转换为 JSON 字符串

vb.net - Visual Basic .NET 是否有大整数类(128 或更多位)?

java - 为什么这个 BigInteger 在输入 FFFFFFFF (8 F) 时显示不正确的结果

rust - 如何使用 hyper 下载大文件并在出错时恢复?

generics - "borrowed value does not live long enough"具有返回 impl 特征的通用函数

struct - 如何为&Struct实现Default?

c# - 使用 BigIntegers 的大阶乘失去精度

java - 随机化一个 BigInteger