Document BigInt's new and from_slice methods

Fixes https://github.com/mozilla/rust/issues/14639
This commit is contained in:
Adolfo Ochagavía 2014-06-05 09:40:43 +02:00
parent 7d07a1e74b
commit 75891274c4
1 changed files with 8 additions and 0 deletions

View File

@ -653,6 +653,8 @@ impl FromStrRadix for BigUint {
impl BigUint {
/// Creates and initializes a `BigUint`.
///
/// The digits are be in base 2^32.
#[inline]
pub fn new(v: Vec<BigDigit>) -> BigUint {
// omit trailing zeros
@ -665,6 +667,8 @@ impl BigUint {
}
/// Creates and initializes a `BigUint`.
///
/// The digits are be in base 2^32.
#[inline]
pub fn from_slice(slice: &[BigDigit]) -> BigUint {
return BigUint::new(Vec::from_slice(slice));
@ -1315,12 +1319,16 @@ impl<R: Rng> RandBigInt for R {
impl BigInt {
/// Creates and initializes a BigInt.
///
/// The digits are be in base 2^32.
#[inline]
pub fn new(sign: Sign, v: Vec<BigDigit>) -> BigInt {
BigInt::from_biguint(sign, BigUint::new(v))
}
/// Creates and initializes a `BigInt`.
///
/// The digits are be in base 2^32.
#[inline]
pub fn from_biguint(sign: Sign, data: BigUint) -> BigInt {
if sign == Zero || data.is_zero() {