Skip to main content

Module codec

Module codec 

Source
Expand description

Binary encode/decode for PostgreSQL types.

All decoding operates on raw byte slices (from the arena or wire buffer). Encoding appends big-endian bytes to a Vec<u8>.

PostgreSQL binary format is big-endian for all numeric types.

Traits§

Encode
Encode a Rust value into PostgreSQL binary format.

Functions§

decode_array_bool
Decode a PG binary array of booleans.
decode_array_bytea
Decode a PG binary array of bytea values.
decode_array_f32
Decode a PG binary array of f32.
decode_array_f64
Decode a PG binary array of f64.
decode_array_i16
Decode a PG binary array of i16.
decode_array_i32
Decode a PG binary array of i32.
decode_array_i64
Decode a PG binary array of i64.
decode_array_str
Decode a PG binary array of text/varchar strings.
decode_bool
Decode a boolean from binary format (1 byte: 0x00 = false, 0x01 = true).
decode_bytes
Decode raw bytes (bytea) — identity function, zero-copy.
decode_f32
Decode a 32-bit float from binary format (4 bytes, big-endian IEEE 754).
decode_f64
Decode a 64-bit float from binary format (8 bytes, big-endian IEEE 754).
decode_i16
Decode a 16-bit integer from binary format (2 bytes, big-endian).
decode_i32
Decode a 32-bit integer from binary format (4 bytes, big-endian).
decode_i64
Decode a 64-bit integer from binary format (8 bytes, big-endian).
decode_str
Decode a UTF-8 string from binary format (variable length).
decode_uuid
Decode a UUID from binary format (exactly 16 bytes).
encode_param
Encode a parameter value into the wire buffer with its 4-byte length prefix.