(options: I)
| 101 | |
| 102 | impl Serialize { |
| 103 | pub fn startup<I, K, V>(options: I) -> Vec<u8> |
| 104 | where |
| 105 | I: IntoIterator<Item = (K, V)>, |
| 106 | K: AsRef<str>, |
| 107 | V: AsRef<str>, |
| 108 | { |
| 109 | let mut writer = BufferWriter::default(); |
| 110 | writer.add_int16(3).add_int16(0); |
| 111 | |
| 112 | for (key, value) in options { |
| 113 | writer.add_cstring(key.as_ref()).add_cstring(value.as_ref()); |
| 114 | } |
| 115 | |
| 116 | writer |
| 117 | .add_cstring("client_encoding") |
| 118 | .add_cstring("UTF8") |
| 119 | .add_cstring(""); |
| 120 | |
| 121 | let body = writer.flush(None); |
| 122 | let length = (body.len() + 4) as i32; |
| 123 | let mut result = Vec::with_capacity(body.len() + 4); |
| 124 | result.extend_from_slice(&length.to_be_bytes()); |
| 125 | result.extend_from_slice(&body); |
| 126 | result |
| 127 | } |
| 128 | |
| 129 | pub fn request_ssl() -> Vec<u8> { |
| 130 | let mut buffer = [0u8; 8]; |
nothing calls this directly
no test coverage detected