fn decode_var_len_u64<R: io::Read>(reader: &mut R) -> io::Result<u64> {
    use byteorder::ReadBytesExt;

    let mut num = 0;
    let mut i = 0;
    loop {
        let byte = reader.read_u8()?;

        if i >= 9 && byte & 0b1111_1110 != 0 {
            // 10th byte
            return Err(io::Error::new(io::ErrorKind::InvalidData, "integer overflow"));
        }
        num |= (byte as u64 & 0b0111_1111) << (i * 7);
        if byte & 0b1000_0000 == 0 {
            break;
        }
        i += 1;
    }
    Ok(num)
}
// Taken from the rust-avro functions with the same name...
// TODO: credit this when creating an ATTRIBUTIONS file or something
Taken from the rust-avro functions with the same name
TODO: credit this when creating an ATTRIBUTIONS file or something
Taken from the rust - avro functions with the same name TODO : credit this when creating an ATTRIBUTIONS file or something
fn decode_var_len_u64<R: io::Read>(reader: &mut R) -> io::Result<u64> {
    use byteorder::ReadBytesExt;
    let mut num = 0;
    let mut i = 0;
    loop {
        let byte = reader.read_u8()?;
        if i >= 9 && byte & 0b1111_1110 != 0 {
            // 10th byte
            return Err(io::Error::new(io::ErrorKind::InvalidData, "integer overflow"));
        }
        num |= (byte as u64 & 0b0111_1111) << (i * 7);
        if byte & 0b1000_0000 == 0 {
            break;
        }
        i += 1;
    }
    Ok(num)
}
fn decode_var_len_u64 < R : io :: Read > ( reader : & mut R ) -> io :: Result < u64 > { use byteorder :: ReadBytesExt ; let mut num = 0 ; let mut i = 0 ; loop { let byte = reader . read_u8 ( ) ? ; if i >= 9 && byte & 0b1111_1110 != 0 { // 10th byte return Err ( io :: Error :: new ( io :: ErrorKind :: InvalidData , " " ) ) ; } num |= ( byte as u64 & 0b0111_1111 ) << ( i * 7 ) ; if byte & 0b1000_0000 == 0 { break ; } i += 1 ; } Ok ( num ) }
Taken from the rust-avro functions with the same name...
TODO: credit this when creating an ATTRIBUTIONS file or something
Taken from the rust - avro functions with the same name ... TODO : credit this when creating an ATTRIBUTIONS file or something
reader
&mut R
reader
&mut R