pub fn read<R: IonDataSource>(data_source: &mut R, length: usize) -> IonResult<UInt> {
        if length > MAX_UINT_SIZE_IN_BYTES {
            return decoding_error(format!(
                "Found a {}-byte UInt. Max supported size is {} bytes.",
                length, MAX_UINT_SIZE_IN_BYTES
            ));
        }

        // Create a stack-allocated buffer to hold the data we're going to read in.
        let mut buffer = [0u8; MAX_UINT_SIZE_IN_BYTES];
        // Get a mutable reference to a portion of the buffer just big enough to fit
        // the requested number of bytes.
        let buffer = &mut buffer[0..length];

        let mut magnitude: UIntStorage = 0;
        data_source.read_exact(buffer)?;
        for &byte in buffer.iter() {
            let byte = u64::from(byte);
            magnitude <<= 8;
            magnitude |= byte;
        }

        Ok(UInt {
            size_in_bytes: length,
            value: magnitude,
        })
    }
/// Reads a UInt with `length` bytes from the provided data source.
Reads a UInt with `length` bytes from the provided data source.
Reads a UInt with ` length ` bytes from the provided data source .
pub fn read<R: IonDataSource>(data_source: &mut R, length: usize) -> IonResult<UInt> {
        if length > MAX_UINT_SIZE_IN_BYTES {
            return decoding_error(format!(
                "Found a {}-byte UInt. Max supported size is {} bytes.",
                length, MAX_UINT_SIZE_IN_BYTES
            ));
        }
        // Create a stack-allocated buffer to hold the data we're going to read in.
        let mut buffer = [0u8; MAX_UINT_SIZE_IN_BYTES];
        // Get a mutable reference to a portion of the buffer just big enough to fit
        // the requested number of bytes.
        let buffer = &mut buffer[0..length];
        let mut magnitude: UIntStorage = 0;
        data_source.read_exact(buffer)?;
        for &byte in buffer.iter() {
            let byte = u64::from(byte);
            magnitude <<= 8;
            magnitude |= byte;
        }
        Ok(UInt {
            size_in_bytes: length,
            value: magnitude,
        })
    }
pub fn read < R : IonDataSource > ( data_source : & mut R , length : usize ) -> IonResult < UInt > { if length > MAX_UINT_SIZE_IN_BYTES { return decoding_error ( format ! ( " " length MAX_UINT_SIZE_IN_BYTES ) ) ; } // Create a stack-allocated buffer to hold the data we're going to read in. let mut buffer = [ 0u8 ; MAX_UINT_SIZE_IN_BYTES ] ; // Get a mutable reference to a portion of the buffer just big enough to fit // the requested number of bytes. let buffer = & mut buffer [ 0 .. length ] ; let mut magnitude : UIntStorage = 0 ; data_source . read_exact ( buffer ) ? ; for & byte in buffer . iter ( ) { let byte = u64 :: from ( byte ) ; magnitude <<= 8 ; magnitude |= byte ; } Ok ( UInt { size_in_bytes : length , value : magnitude , } ) }
Reads a UInt with `length` bytes from the provided data source.
Reads a UInt with ` length ` bytes from the provided data source .
data_source
&mut R
length
usize
data_source
&mut R
length
usize