pub fn parse_bytes(buf: &[u8], radix: uint) -> Option<BigUint> {
        let (base, unit_len) = get_radix_base(radix);
        let base_num = match FromPrimitive::from_uint(base) {
            Some(base_num) => base_num,
            None => { return None; }
        };

        let mut end             = buf.len();
        let mut n: BigUint      = Zero::zero();
        let mut power: BigUint  = One::one();
        loop {
            let start = num::max(end, unit_len) - unit_len;
            match uint::parse_bytes(buf.slice(start, end), radix) {
                Some(d) => {
                    let d: Option<BigUint> = FromPrimitive::from_uint(d);
                    match d {
                        Some(d) => {
                            // FIXME(#6102): Assignment operator for BigInt
                            // causes ICE:
                            // n += d * power;
                            n = n + d * power;
                        }
                        None => { return None; }
                    }
                }
                None => { return None; }
            }
            if end <= unit_len {
                return Some(n);
            }
            end -= unit_len;
            // FIXME(#6050): overloaded operators force moves with generic types
            // power *= base_num;
            power = power * base_num;
        }
    }
/// Creates and initializes a `BigUint`.
Creates and initializes a `BigUint`.
Creates and initializes a ` BigUint ` .
pub fn parse_bytes(buf: &[u8], radix: uint) -> Option<BigUint> {
        let (base, unit_len) = get_radix_base(radix);
        let base_num = match FromPrimitive::from_uint(base) {
            Some(base_num) => base_num,
            None => { return None; }
        };
        let mut end             = buf.len();
        let mut n: BigUint      = Zero::zero();
        let mut power: BigUint  = One::one();
        loop {
            let start = num::max(end, unit_len) - unit_len;
            match uint::parse_bytes(buf.slice(start, end), radix) {
                Some(d) => {
                    let d: Option<BigUint> = FromPrimitive::from_uint(d);
                    match d {
                        Some(d) => {
                            // FIXME(#6102): Assignment operator for BigInt
                            // causes ICE:
                            // n += d * power;
                            n = n + d * power;
                        }
                        None => { return None; }
                    }
                }
                None => { return None; }
            }
            if end <= unit_len {
                return Some(n);
            }
            end -= unit_len;
            // FIXME(#6050): overloaded operators force moves with generic types
            // power *= base_num;
            power = power * base_num;
        }
    }
pub fn parse_bytes ( buf : & [ u8 ] , radix : uint ) -> Option < BigUint > { let ( base , unit_len ) = get_radix_base ( radix ) ; let base_num = match FromPrimitive :: from_uint ( base ) { Some ( base_num ) => base_num , None => { return None ; } } ; let mut end = buf . len ( ) ; let mut n : BigUint = Zero :: zero ( ) ; let mut power : BigUint = One :: one ( ) ; loop { let start = num :: max ( end , unit_len ) - unit_len ; match uint :: parse_bytes ( buf . slice ( start , end ) , radix ) { Some ( d ) => { let d : Option < BigUint > = FromPrimitive :: from_uint ( d ) ; match d { Some ( d ) => { // FIXME(#6102): Assignment operator for BigInt // causes ICE: // n += d * power; n = n + d * power ; } None => { return None ; } } } None => { return None ; } } if end <= unit_len { return Some ( n ) ; } end -= unit_len ; // FIXME(#6050): overloaded operators force moves with generic types // power *= base_num; power = power * base_num ; } }
Creates and initializes a `BigUint`.
Creates and initializes a ` BigUint ` .
buf
&[u8]
radix
uint
buf
&[u8]
radix
uint