kernel_sidecar/jupyter/iopub_content/
execute_result.rs

1/*
2https://jupyter-client.readthedocs.io/en/latest/messaging.html#id6
3*/
4use std::collections::HashMap;
5
6use bytes::Bytes;
7
8use serde::{Deserialize, Serialize};
9
10#[allow(dead_code)]
11#[derive(Clone, Serialize, PartialEq, Deserialize, Debug)]
12pub struct ExecuteResult {
13    pub execution_count: u32,
14    pub data: HashMap<String, serde_json::Value>,
15    pub metadata: serde_json::Value,
16}
17
18impl From<Bytes> for ExecuteResult {
19    fn from(bytes: Bytes) -> Self {
20        serde_json::from_slice(&bytes).expect("Failed to deserialize ExecuteResult")
21    }
22}