Skip to main content

Module frontend

Module frontend 

Source
Expand description

Frontend (client → server) message encoding.

Messages are appended to a caller-owned [BytesMut] so that a full request (Parse + Describe + Bind + Execute + Sync) can be assembled in one buffer and written with a single syscall.

Counts and lengths taken from the caller are range-checked before being written: a silently truncated length prefix makes the server reinterpret the rest of the buffer as new protocol messages.

Constants§

MAX_VALUE_COUNT
Maximum number of values in one Bind or COPY row.

Functions§

begin
Starts a tagged message, writing the tag and a placeholder length.
bind_finish
Finishes a Bind message.
bind_start
Starts a Bind message; call write_param for each value, then bind_finish.
cancel_request
Encodes a CancelRequest message (no tag; sent on a fresh connection).
close
Encodes a Close (kind is b'S' for a statement or b'P' for a portal).
copy_data
Encodes a CopyData.
copy_done
Encodes a CopyDone.
copy_fail
Encodes a CopyFail.
describe
Encodes a Describe (kind is b'S' for a statement or b'P' for a portal).
execute
Encodes an Execute.
finish
Patches the length field written by begin.
flush
Encodes a Flush.
parse
Encodes a Parse.
password
Encodes a cleartext password message (PasswordMessage).
put_cstr
Appends a raw C string terminated by a NUL byte.
query
Encodes a simple Query.
sasl_initial_response
Encodes a SASLInitialResponse.
sasl_response
Encodes a SASLResponse.
ssl_request
Encodes an SSLRequest message.
startup
Encodes the startup message (no tag).
sync
Encodes a Sync.
terminate
Encodes a Terminate.
write_param
Writes one Bind parameter; None is encoded as SQL NULL.