pub fn startup_message(
parameters: &[(&str, &str)],
buf: &mut BytesMut,
) -> Result<()>Expand description
Writes a startup message to the buffer.
The startup message establishes the connection and sets initial parameters. This is the first message sent by the client after establishing a TCP connection.
§Arguments
parameters- Key-value pairs of connection parameters (e.g., “user”, “database”)buf- Buffer to write the message to
§Errors
Currently infallible — always returns Ok(()). The io::Result return
type is preserved for forward compatibility so that future validation
(e.g. parameter-length checks) can surface errors without a breaking
signature change.
§Panics
Panics via msg_len if the total encoded message length exceeds
i32::MAX bytes (~2 GiB). PostgreSQL caps messages at that size, so
exceeding it is a programming error.