pub fn read_u64(r: &mut ByteCursor) -> Result<u64, Error> {
  let mut b = varint_encode::u64_buffer();
  for i in 0..b.len() {
    let n = r.read(&mut b[i..(i + 1)]);
    if n == 0 {
      return Err(Error::Varint(decode::Error::Overflow));
    }
    if decode::is_last(b[i]) {
      match decode::u64(&b[..=i]) {
        Ok(d) => return Ok(d.0),
        Err(_) => return Err(Error::Varint(decode::Error::Overflow)),
      };
      // return Ok(decode::u64(&b[..=i]).unwrap().0);
    }
  }
  Err(Error::Varint(decode::Error::Overflow))
}
/// Reads 64 bits from a byte array into a u64 starting at the current
/// Bytecursor position Adapted from unsigned-varint's read_u64 generated
/// function
Reads 64 bits from a byte array into a u64 starting at the current
Bytecursor position Adapted from unsigned-varint's read_u64 generated
function
Reads 64 bits from a byte array into a u64 starting at the current Bytecursor position Adapted from unsigned - varint ' s read_u64 generated function
pub fn read_u64(r: &mut ByteCursor) -> Result<u64, Error> {
  let mut b = varint_encode::u64_buffer();
  for i in 0..b.len() {
    let n = r.read(&mut b[i..(i + 1)]);
    if n == 0 {
      return Err(Error::Varint(decode::Error::Overflow));
    }
    if decode::is_last(b[i]) {
      match decode::u64(&b[..=i]) {
        Ok(d) => return Ok(d.0),
        Err(_) => return Err(Error::Varint(decode::Error::Overflow)),
      };
      // return Ok(decode::u64(&b[..=i]).unwrap().0);
    }
  }
  Err(Error::Varint(decode::Error::Overflow))
}
pub fn read_u64 ( r : & mut ByteCursor ) -> Result < u64 , Error > { let mut b = varint_encode :: u64_buffer ( ) ; for i in 0 .. b . len ( ) { let n = r . read ( & mut b [ i .. ( i + 1 ) ] ) ; if n == 0 { return Err ( Error :: Varint ( decode :: Error :: Overflow ) ) ; } if decode :: is_last ( b [ i ] ) { match decode :: u64 ( & b [ .. = i ] ) { Ok ( d ) => return Ok ( d . 0 ) , Err ( _ ) => return Err ( Error :: Varint ( decode :: Error :: Overflow ) ) , } ; // return Ok(decode::u64(&b[..=i]).unwrap().0); } } Err ( Error :: Varint ( decode :: Error :: Overflow ) ) }
Reads 64 bits from a byte array into a u64 starting at the current
Bytecursor position Adapted from unsigned-varint's read_u64 generated
function
Reads 64 bits from a byte array into a u64 starting at the current Bytecursor position Adapted from unsigned - varint ' s read_u64 generated function
r
&mut ByteCursor
r
&mut ByteCursor