2016-01-13 25 views
1

我想大整數魯斯特加在一起:不穩定的庫功能「核心」問題的解決方法是什麼?

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; 

有沒有在這個時候任何解決方法嗎?或者暫時完全不可行?

回答

3

您應該可以使用std::ops::Add特性而不是core::ops::Add

use std::ops::Add; 
+0

謝謝!這工作。雖然好奇......有沒有一種方法可以根據文檔找出答案,而不是在論壇上提問? –

+1

[核心文檔](https://doc.rust-lang.org/stable/core/)表示'不推薦使用核心庫。 libcore的穩定功能是從標準庫中重新導出的,並提供了[std](https://doc.rust-lang.org/stable/std/)文檔的鏈接。 –

+0

明白了,再次感謝! –

相關問題