Expand description
const-varint
§Installation
[dependencies]
const-varint = "0.1"-
For
ruint::Uint<BITS, LBITS>support (not compatible inconstcontext)const-varint = { version = "0.1", features = ["ruint_1"] }
§License
const-varint is under the terms of both the MIT license and the
Apache License (Version 2.0).
See LICENSE-APACHE, LICENSE-MIT for details.
Copyright (c) 2025 Al Liu.
Structs§
- I16Varint
Buffer - A buffer for storing LEB128 encoded i16 values.
- I32Varint
Buffer - A buffer for storing LEB128 encoded i32 values.
- I64Varint
Buffer - A buffer for storing LEB128 encoded i64 values.
- I128
Varint Buffer - A buffer for storing LEB128 encoded i128 values.
- U16Varint
Buffer - A buffer for storing LEB128 encoded u16 values.
- U32Varint
Buffer - A buffer for storing LEB128 encoded u32 values.
- U64Varint
Buffer - A buffer for storing LEB128 encoded u64 values.
- U128
Varint Buffer - A buffer for storing LEB128 encoded u128 values.
Enums§
- Decode
Error - Decoding varint error.
- Encode
Error - Encode varint error
Traits§
- Varint
- A trait for types that can be encoded as variable-length integers (varints).
Functions§
- decode_
i16_ varint - Decodes a
u16in LEB128 encoded format from the buffer. - decode_
i32_ varint - Decodes a
u32in LEB128 encoded format from the buffer. - decode_
i64_ varint - Decodes a
u64in LEB128 encoded format from the buffer. - decode_
i128_ varint - Decodes a
u128in LEB128 encoded format from the buffer. - decode_
u16_ varint - Decodes a
i16in LEB128 encoded format from the buffer. - decode_
u32_ varint - Decodes a
i32in LEB128 encoded format from the buffer. - decode_
u64_ varint - Decodes a
i64in LEB128 encoded format from the buffer. - decode_
u128_ varint - Decodes a
i128in LEB128 encoded format from the buffer. - encode_
i16_ varint - Encodes an
i16value into LEB128 variable length format, and writes it to the buffer. - encode_
i32_ varint - Encodes an
i32value into LEB128 variable length format, and writes it to the buffer. - encode_
i64_ varint - Encodes an
i64value into LEB128 variable length format, and writes it to the buffer. - encode_
i128_ varint - Encodes an
i128value into LEB128 variable length format, and writes it to the buffer. - encode_
u16_ varint - Encodes an
u16value into LEB128 variable length format, and writes it to the buffer. - encode_
u32_ varint - Encodes an
u32value into LEB128 variable length format, and writes it to the buffer. - encode_
u64_ varint - Encodes an
u64value into LEB128 variable length format, and writes it to the buffer. - encode_
u128_ varint - Encodes an
u128value into LEB128 variable length format, and writes it to the buffer. - encoded_
i16_ varint_ len - Returns the encoded length of the value in LEB128 variable length format.
The returned value will be in range of
i16::ENCODED_LEN_RANGE. - encoded_
i32_ varint_ len - Returns the encoded length of the value in LEB128 variable length format.
The returned value will be in range of
i32::ENCODED_LEN_RANGE. - encoded_
i64_ varint_ len - Returns the encoded length of the value in LEB128 variable length format.
The returned value will be in range
i64::ENCODED_LEN_RANGE. - encoded_
i128_ varint_ len - Returns the encoded length of the value in LEB128 variable length format.
The returned value will be in range
i128::ENCODED_LEN_RANGE. - encoded_
u16_ varint_ len - Returns the encoded length of the value in LEB128 variable length format.
The returned value will be in range of
u16::ENCODED_LEN_RANGE. - encoded_
u32_ varint_ len - Returns the encoded length of the value in LEB128 variable length format.
The returned value will be in range of
u32::ENCODED_LEN_RANGE. - encoded_
u64_ varint_ len - Returns the encoded length of the value in LEB128 variable length format.
The returned value will be in range
u64::ENCODED_LEN_RANGE. - encoded_
u128_ varint_ len - Returns the encoded length of the value in LEB128 variable length format.
The returned value will be in range
u128::ENCODED_LEN_RANGE.