Skip to main content

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

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