MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / write

Method write

nodedb/src/engine/graph/algo/result.rs:199–226  ·  view source on GitHub ↗
(&self, writer: &mut W)

Source from the content-addressed store, hash-verified

197
198impl zerompk::ToMessagePack for AlgoResultBatch {
199 fn write<W: zerompk::Write>(&self, writer: &mut W) -> zerompk::Result<()> {
200 let schema = self.algorithm.result_schema();
201 let num_cols = schema.len();
202
203 writer.write_array_len(self.row_count)?;
204
205 for row_idx in 0..self.row_count {
206 writer.write_map_len(num_cols)?;
207
208 for (col_idx, &(col_name, _)) in schema.iter().enumerate() {
209 let (col_type, vec_idx) = self.column_map[col_idx];
210 writer.write_string(col_name)?;
211 match col_type {
212 AlgoColumnType::Text => {
213 writer.write_string(&self.text_columns[vec_idx][row_idx])?;
214 }
215 AlgoColumnType::Float64 => {
216 writer.write_f64(self.f64_columns[vec_idx][row_idx])?;
217 }
218 AlgoColumnType::Int64 => {
219 writer.write_i64(self.i64_columns[vec_idx][row_idx])?;
220 }
221 }
222 }
223 }
224
225 Ok(())
226 }
227}
228
229#[cfg(test)]

Callers

nothing calls this directly

Calls 3

result_schemaMethod · 0.80
lenMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected