(core: &CoreLoop, task: &ExecutionTask, rows: &[Value])
| 18 | use crate::data::executor::task::ExecutionTask; |
| 19 | |
| 20 | pub(super) fn encode_value_rows(core: &CoreLoop, task: &ExecutionTask, rows: &[Value]) -> Response { |
| 21 | let mut buf: Vec<u8> = Vec::with_capacity(rows.len() * 64); |
| 22 | write_array_header(&mut buf, rows.len()); |
| 23 | for row in rows { |
| 24 | match nodedb_types::value_to_msgpack(row) { |
| 25 | Ok(b) => buf.extend_from_slice(&b), |
| 26 | Err(e) => { |
| 27 | return core.response_error( |
| 28 | task, |
| 29 | ErrorCode::Internal { |
| 30 | detail: format!("array response encode: {e}"), |
| 31 | }, |
| 32 | ); |
| 33 | } |
| 34 | } |
| 35 | } |
| 36 | core.response_with_payload(task, buf) |
| 37 | } |
| 38 | |
| 39 | fn write_array_header(buf: &mut Vec<u8>, len: usize) { |
| 40 | if len < 16 { |
no test coverage detected