Crate varu64 [] [src]

A variable length encoding of u64 integers, based on multiformats varints, but using the most significant bit of a 9-byte encoded integer to encode the most significant bit of a u64 rather than using it a a continuation bit.

Structs

Decode

A future for decoding a u64 from an AsyncRead.

DecodeDeserialize

A decoder that implements the AsyncDeserialize trait.

Encode

A future for encoding a u64 into an AsyncWrite.

Constants

MAX_1

The largest u64 that fits into one byte of encoding: 2u64.pow(7 * 1) - 1

MAX_2

The largest u64 that fits into two bytes of encoding: 2u64.pow(7 * 2) - 1

MAX_3

The largest u64 that fits into three bytes of encoding: 2u64.pow(7 * 3) - 1

MAX_4

The largest u64 that fits into four bytes of encoding: 2u64.pow(7 * 4) - 1

MAX_5

The largest u64 that fits into five bytes of encoding: 2u64.pow(7 * 5) - 1

MAX_6

The largest u64 that fits into six bytes of encoding: 2u64.pow(7 * 6) - 1

MAX_7

The largest u64 that fits into seven bytes of encoding: 2u64.pow(7 * 7) - 1

MAX_8

The largest u64 that fits into eight bytes of encoding: 2u64.pow(7 * 8) - 1

MAX_9

The largest u64 that fits into nine bytes of encoding.

MAX_LENGTH

The largest number of bytes an encoding can consume.

Functions

decode_bytes

Try to decode from a slice of bytes.

decode_reader

Try to decode from a Read, returning how many bytes were read.

encode_bytes

Try to encode into a slice of bytes, returning the length of the encoding in bytes.

encode_writer

Try to encode into a Write, returning how many bytes were written.

len

Return the number of bytes needed to encode the given u64.