Skip to main content

muse_code_sdk/msp/view/
event_wire_words.rs

1// @generated from the MSP stable schema and protocol sources; do not edit by hand.
2
3use super::event::TurnErrorKind;
4use super::event::TurnTerminal;
5use serde::Deserialize;
6use serde::Deserializer;
7use serde::Serialize;
8use serde::Serializer;
9
10impl TurnTerminal {
11    /// The exact wire spelling, including a value from a newer host.
12    #[must_use]
13    pub fn as_str(&self) -> &str {
14        match self {
15            Self::Completed => "completed",
16            Self::Failed => "failed",
17            Self::Cancelled => "cancelled",
18            Self::Unknown(value) => value,
19        }
20    }
21}
22
23impl Serialize for TurnTerminal {
24    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
25    where
26        S: Serializer,
27    {
28        serializer.serialize_str(self.as_str())
29    }
30}
31
32impl<'de> Deserialize<'de> for TurnTerminal {
33    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
34    where
35        D: Deserializer<'de>,
36    {
37        let value = String::deserialize(deserializer)?;
38        Ok(match value.as_str() {
39            "completed" => Self::Completed,
40            "failed" => Self::Failed,
41            "cancelled" => Self::Cancelled,
42            _ => Self::Unknown(value),
43        })
44    }
45}
46
47impl TurnErrorKind {
48    /// The exact wire spelling, including a value from a newer host.
49    #[must_use]
50    pub fn as_str(&self) -> &str {
51        match self {
52            Self::StepLimit => "stepLimit",
53            Self::ConfigError => "configError",
54            Self::ProjectionError => "projectionError",
55            Self::LogError => "logError",
56            Self::WorkflowLaunchError => "workflowLaunchError",
57            Self::EnvironmentError => "environmentError",
58            Self::ModelError => "modelError",
59            Self::LaunchError => "launchError",
60            Self::AuthRequired => "authRequired",
61            Self::McpLinkError => "mcpLinkError",
62            Self::Unknown(value) => value,
63        }
64    }
65}
66
67impl Serialize for TurnErrorKind {
68    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
69    where
70        S: Serializer,
71    {
72        serializer.serialize_str(self.as_str())
73    }
74}
75
76impl<'de> Deserialize<'de> for TurnErrorKind {
77    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
78    where
79        D: Deserializer<'de>,
80    {
81        let value = String::deserialize(deserializer)?;
82        Ok(match value.as_str() {
83            "stepLimit" => Self::StepLimit,
84            "configError" => Self::ConfigError,
85            "projectionError" => Self::ProjectionError,
86            "logError" => Self::LogError,
87            "workflowLaunchError" => Self::WorkflowLaunchError,
88            "environmentError" => Self::EnvironmentError,
89            "modelError" => Self::ModelError,
90            "launchError" => Self::LaunchError,
91            "authRequired" => Self::AuthRequired,
92            "mcpLinkError" => Self::McpLinkError,
93            _ => Self::Unknown(value),
94        })
95    }
96}