Skip to main content

objectiveai_sdk/functions/executions/response/unary/
function_execution_task.rs

1use crate::functions::executions::response;
2use serde::{Deserialize, Serialize};
3use schemars::JsonSchema;
4
5#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
6#[schemars(rename = "functions.executions.response.unary.FunctionExecutionTask")]
7pub struct FunctionExecutionTask {
8    pub index: u64,
9    pub task_index: u64,
10    pub task_path: Vec<u64>,
11    #[serde(skip_serializing_if = "Option::is_none")]
12    #[schemars(extend("omitempty" = true))]
13    pub swiss_pool_index: Option<u64>,
14    #[serde(skip_serializing_if = "Option::is_none")]
15    #[schemars(extend("omitempty" = true))]
16    pub swiss_round: Option<u64>,
17    #[serde(skip_serializing_if = "Option::is_none")]
18    #[schemars(extend("omitempty" = true))]
19    pub split_index: Option<u64>,
20    #[serde(flatten)]
21    pub inner: super::FunctionExecution,
22}
23
24impl From<response::streaming::FunctionExecutionTaskChunk>
25    for FunctionExecutionTask
26{
27    fn from(
28        response::streaming::FunctionExecutionTaskChunk {
29            index,
30            task_index,
31            task_path,
32            swiss_pool_index,
33            swiss_round,
34            split_index,
35            inner,
36        }: response::streaming::FunctionExecutionTaskChunk,
37    ) -> Self {
38        Self {
39            index,
40            task_index,
41            task_path,
42            swiss_pool_index,
43            swiss_round,
44            split_index,
45            inner: inner.into(),
46        }
47    }
48}