Crate length_delimited

Crate length_delimited 

Source
Expand description

length-delimited

Protobuf like length-delimited encoding/decoding.

github LoC Build codecov

docs.rs crates.io crates.io license

§Installation

[dependencies]
length-delimited = "0.2"
§License

length-delimited 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§

IncompleteBuffer
Returned when the buffer does not contains engouth bytes for decoding.
InsufficientBuffer
Returned when the encoded buffer is too small to hold the bytes format of the types.

Enums§

DecodeBytesError
The error that can be returned when decoding bytes.
DecodeCharError
Error when decoding a character
DecodeUtf8BytesError
The error that can be returned when decoding utf8 bytes.
DecodeVarintError
Decoding varint error.
EncodeError
Encode varint error

Traits§

Bounds
A trait bound that bounds Send, Sync, and 'static in possible combinations
ErrorBounds
A trait bound that bounds Debug, Display, Error, Send, Sync, and 'static in possible combinations
LengthDelimitedDecoder
A type can be encode to a buffer.
LengthDelimitedEncoder
A type can be encode to a buffer.
Varint
A trait for types that can be encoded as variable-length integers (varints).

Functions§

decode_i16_varint
Decodes a u16 in LEB128 encoded format from the buffer.
decode_i32_varint
Decodes a u32 in LEB128 encoded format from the buffer.
decode_i64_varint
Decodes a u64 in LEB128 encoded format from the buffer.
decode_i128_varint
Decodes a u128 in LEB128 encoded format from the buffer.
decode_u16_varint
Decodes a i16 in LEB128 encoded format from the buffer.
decode_u32_varint
Decodes a i32 in LEB128 encoded format from the buffer.
decode_u64_varint
Decodes a i64 in LEB128 encoded format from the buffer.
decode_u128_varint
Decodes a i128 in LEB128 encoded format from the buffer.
encode_i16_varint
Encodes an i16 value into LEB128 variable length format, and writes it to the buffer.
encode_i32_varint
Encodes an i32 value into LEB128 variable length format, and writes it to the buffer.
encode_i64_varint
Encodes an i64 value into LEB128 variable length format, and writes it to the buffer.
encode_i128_varint
Encodes an i128 value into LEB128 variable length format, and writes it to the buffer.
encode_u16_varint
Encodes an u16 value into LEB128 variable length format, and writes it to the buffer.
encode_u32_varint
Encodes an u32 value into LEB128 variable length format, and writes it to the buffer.
encode_u64_varint
Encodes an u64 value into LEB128 variable length format, and writes it to the buffer.
encode_u128_varint
Encodes an u128 value 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.