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

Method startup

src/protocol/serializer.rs:103–127  ·  view source on GitHub ↗
(options: I)

Source from the content-addressed store, hash-verified

101
102impl 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];

Callers

nothing calls this directly

Calls 4

lenMethod · 0.80
add_int16Method · 0.45
add_cstringMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected