Skip to main content

Module keyval

Module keyval 

Source
Expand description

Key and value byte aliases plus database codec adapters.

The aliases distinguish keys from values while sharing compact storage; raw aliases default to borrowed byte slices, while buffer aliases provide inline capacity for common payload sizes. Serialization helpers encode typed components with the database record codec, and projection helpers consume pairs to return one component without cloning or reserializing it.

Constantsยง

DEF_STACK_CAP
Default inline byte capacity for a generic Buffer.
KEY_STACK_CAP
Default inline byte capacity for serialized keys.
VAL_STACK_CAP
Default inline byte capacity for serialized values.

Functionsยง

_expect_deserialize ๐Ÿ”’
Deserializes both components and treats any input or codec error as fatal.
_expect_deserialize_key ๐Ÿ”’
Deserializes a key and treats any input or codec error as fatal.
deserialize ๐Ÿ”’
deserialize_key ๐Ÿ”’
deserialize_val ๐Ÿ”’
key
Returns the key component of a database pair.
result_deserialize ๐Ÿ”’
result_deserialize_key ๐Ÿ”’
serialize_key
Serializes a database key into an inline-backed key buffer.
serialize_val
Serializes a database value into an inline-backed value buffer.
val
Returns the value component of a database pair.

Type Aliasesยง

Buffer
Inline-backed byte buffer used by serialized keys and values.
Byte
Byte element used by raw database slices and buffers.
Key
Database key, borrowing a raw byte slice by default.
KeyBuf
Default inline-backed buffer for a serialized key.
KeyBuffer
Inline-backed key buffer with a configurable byte capacity.
KeyVal
Database key and value pair, borrowing raw byte slices by default.
Slice
Unsized byte slice used by raw database APIs.
Val
Database value, borrowing a raw byte slice by default.
ValBuf
Default inline-backed buffer for a serialized value.
ValBuffer
Inline-backed value buffer with a configurable byte capacity.