MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / startup_message_with

Function startup_message_with

tests/client_compat.rs:1108–1122  ·  view source on GitHub ↗
(params: &[(&str, &str)])

Source from the content-addressed store, hash-verified

1106}
1107
1108fn startup_message_with(params: &[(&str, &str)]) -> Vec<u8> {
1109 let mut body = Vec::new();
1110 body.extend_from_slice(&3_i16.to_be_bytes());
1111 body.extend_from_slice(&0_i16.to_be_bytes());
1112 for (key, value) in params {
1113 add_cstring(&mut body, key);
1114 add_cstring(&mut body, value);
1115 }
1116 add_cstring(&mut body, "");
1117
1118 let mut packet = Vec::with_capacity(body.len() + 4);
1119 packet.extend_from_slice(&((body.len() + 4) as i32).to_be_bytes());
1120 packet.extend_from_slice(&body);
1121 packet
1122}
1123
1124fn query_message(sql: &str) -> Vec<u8> {
1125 let mut body = Vec::new();

Calls 2

add_cstringFunction · 0.85
lenMethod · 0.80

Tested by

no test coverage detected