Skip to main content

Module codec

Module codec 

Source
Expand description

A Codec is a trait that provides encode and decode to convert to/from different byte encoding formats

Structs§

CodeDictionarystd
Simple auto-incrementing dictionary indexed by hash value. Creates new codes for new values when first seen. Increments in order of query.
GroupVarintCodeDecoderstd
GroupVarintCodeEncoderstd
Converts values into codes using CodeDictionary, then uses GroupVarintCodeEncoder to encode a sequence of 4 codes to the stream. If a code hasn’t been written before, we immediately follow the group varint block with the specific coded value(s) (up to 4).
SharedCodeDictionarystd
Wraps CodeDictionary in an Arc<RwLock>> for shared access.
SharedGroupVarintCodeEncoderstd
Converts values into codes using CodeDictionary, then uses GroupVarintCodeEncoder to encode a sequence of 4 codes to the stream. If a code hasn’t been written before, we immediately follow the group varint block with the specific coded value(s) (up to 4).

Traits§

Codec
Something that can encode or decode bytes to bytes
DecodeGroupVarintFrom
DecodeUsedBytesFrom
DecodeVByte
DecodeVarint
Decodes up to 9 bytes in the sqlite4 varint format
EncodeGroupVarintTo
The ‘Group Varint’ format, which moves all the control bits to header bytes
EncodeUsedBytesTo
Writes only the used number of bytes in the integer to the output stream.
EncodeVBytealloc
EncodeVByteLength
EncodeVByteTo
EncodeVarintTo
Encodes up to 9 bytes in the sqlite4 varint format.
GroupVarintRequiredLength
The required length to encode in the group varint format. Either 1, 2, 3, or 4 bytes.
ZagZig
ZigZag

Functions§

decode_varint
Decodes up to 9 bytes in the sqlite4 varint format
decode_vbyte
encode_7bits
encode_8bits
encode_14bits
14 bits = 0x3FFF
encode_16bits
16 bits => 0xFFFF
encode_21bits
21 bits => 0x1F_FFFF
encode_28bits
28 bits => 0xFFF_FFFF
encode_32bits
32 bits => 0xFFFF_FFFF
encode_35bits
35 bits => 0x7_FFFF_FFFF
encode_42bits
42 bits => 0x3FF_FFFF_FFFF
encode_49bits
49 bits => 0x1_FFFF_FFFF_FFFF
encode_56bits
56 bits => 0xFF_FFFF_FFFF_FFFF
encode_63bits
63 bits => 0x7FFF_FFFF_FFFF_FFFF
encode_64bits
64 bits => 0xFFFF_FFFF_FFFF_FFFF
encode_integeralloc
encode_integer_to
encode_le_integer_to
encode_u128bits
70 bits => 0x3F_FFFF_FFFF_FFFF_FFFF
encode_varint_to
Encodes up to 9 bytes in the sqlite4 varint format. Returns the number of bytes actually written.
encode_vbyte_to
gvarint_length
The required length to encode in the group varint format. Either 1, 2, 3, or 4 bytes.
resultant_length
zagzig_u8
zagzig_u16
zagzig_u32
zagzig_u64
zagzig_u128
zigzag_i8
zigzag_i16
zigzag_i32
zigzag_i64
zigzag_i128