Expand description
UTF-8 strings and Kafka’s fixed/compact length-prefixed encodings.
KafkaString is backed by Bytes so decoded messages can borrow from
the frame buffer without copying.
Kafka uses four string shapes:
| Variant | Length encoding |
|---|---|
read_string / write_string | i16 |
read_compact_string / … | unsigned varint of len + 1 |
read_nullable_string / … | i16 (-1 = null) |
read_compact_nullable_string | varint (0 = null) |
Re-exports§
pub use self::error::StringError;pub use self::error::StringErrorKind;
Modules§
- error
- Error types for
crate::string.
Structs§
- Kafka
String - A Kafka protocol string backed by
Bytesfor zero-copy access.
Functions§
- compact_
nullable_ string_ len - Encoded length of a nullable compact Kafka string.
- compact_
string_ len - Encoded length of a compact Kafka string.
- nullable_
string_ len - Encoded length of a nullable non-flexible Kafka string.
- read_
compact_ nullable_ string - Read a nullable compact Kafka string (unsigned varint,
0= null). - read_
compact_ string - Read a compact Kafka string (unsigned varint of
len + 1). - read_
nullable_ string - Read a nullable non-flexible Kafka string (
i16,-1= null). - read_
string - Read a non-flexible Kafka string (
i16length prefix). - string_
len - Encoded length of a non-flexible Kafka string (
i16length prefix). - write_
compact_ nullable_ string - Write a nullable compact Kafka string (unsigned varint,
0= null). - write_
compact_ string - Write a compact Kafka string (unsigned varint of
len + 1). - write_
nullable_ string - Write a nullable non-flexible Kafka string (
i16,-1= null). - write_
string - Write a non-flexible Kafka string (
i16length prefix).
Type Aliases§
- Result
- Result alias for string read operations.