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

Function data_row

src/protocol/tests.rs:192–208  ·  view source on GitHub ↗
(values: &[Option<&str>])

Source from the content-addressed store, hash-verified

190 }
191
192 pub fn data_row(values: &[Option<&str>]) -> Vec<u8> {
193 let mut list = BufferList::new();
194 list.add_int16(values.len() as i16);
195 for value in values {
196 match value {
197 Some(val) => {
198 let bytes = val.as_bytes();
199 list.add_int32(bytes.len() as i32);
200 list.add_bytes(bytes);
201 }
202 None => {
203 list.add_int32(-1);
204 }
205 }
206 }
207 list.join(true, Some(b'D'))
208 }
209
210 pub fn error(fields: &[(&str, &str)]) -> Vec<u8> {
211 error_or_notice(fields).join(true, Some(b'E'))

Calls 5

lenMethod · 0.80
add_int16Method · 0.45
add_int32Method · 0.45
add_bytesMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected