Skip to main content

muse_code_sdk/msp/method/lifecycle/session_resume/
catch_all.rs

1// @generated from the MSP stable schema and protocol sources; do not edit by hand.
2
3use super::{HistoryMode, HistoryNoneReason, PendingRequestKind};
4use serde::{Deserialize, Deserializer, Serialize, Serializer};
5
6impl HistoryNoneReason {
7    /// The exact wire spelling, including an unknown word kept verbatim.
8    pub fn as_str(&self) -> &str {
9        match self {
10            Self::Excluded => "excluded",
11            Self::CursorSuffix => "cursorSuffix",
12            Self::HistoryBudget => "historyBudget",
13            Self::ProjectionUnavailable => "projectionUnavailable",
14            Self::ProjectionReadLimit => "projectionReadLimit",
15            Self::Unknown(word) => word,
16        }
17    }
18}
19
20impl Serialize for HistoryNoneReason {
21    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
22        serializer.serialize_str(self.as_str())
23    }
24}
25
26impl<'de> Deserialize<'de> for HistoryNoneReason {
27    fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
28        let word = String::deserialize(deserializer)?;
29        Ok(match word.as_str() {
30            "excluded" => Self::Excluded,
31            "cursorSuffix" => Self::CursorSuffix,
32            "historyBudget" => Self::HistoryBudget,
33            "projectionUnavailable" => Self::ProjectionUnavailable,
34            "projectionReadLimit" => Self::ProjectionReadLimit,
35            _ => Self::Unknown(word),
36        })
37    }
38}
39
40impl HistoryMode {
41    /// The exact wire spelling, including an unknown word kept verbatim.
42    pub fn as_str(&self) -> &str {
43        match self {
44            Self::AnchoredSnapshot => "anchoredSnapshot",
45            Self::Inline => "inline",
46            Self::Snapshot => "snapshot",
47            Self::None => "none",
48            Self::Unknown(word) => word,
49        }
50    }
51}
52
53impl Serialize for HistoryMode {
54    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
55        serializer.serialize_str(self.as_str())
56    }
57}
58
59impl<'de> Deserialize<'de> for HistoryMode {
60    fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
61        let word = String::deserialize(deserializer)?;
62        Ok(match word.as_str() {
63            "anchoredSnapshot" => Self::AnchoredSnapshot,
64            "inline" => Self::Inline,
65            "snapshot" => Self::Snapshot,
66            "none" => Self::None,
67            _ => Self::Unknown(word),
68        })
69    }
70}
71
72impl PendingRequestKind {
73    /// The exact wire spelling, including an unknown word kept verbatim.
74    pub fn as_str(&self) -> &str {
75        match self {
76            Self::Approval => "approval",
77            Self::UserInput => "userInput",
78            Self::Unknown(word) => word,
79        }
80    }
81}
82
83impl Serialize for PendingRequestKind {
84    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
85        serializer.serialize_str(self.as_str())
86    }
87}
88
89impl<'de> Deserialize<'de> for PendingRequestKind {
90    fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
91        let word = String::deserialize(deserializer)?;
92        Ok(match word.as_str() {
93            "approval" => Self::Approval,
94            "userInput" => Self::UserInput,
95            _ => Self::Unknown(word),
96        })
97    }
98}