risingwave_pb/
serverless_backfill_controller.serde.rs

1use crate::serverless_backfill_controller::*;
2impl serde::Serialize for ProvisionRequest {
3    #[allow(deprecated)]
4    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5    where
6        S: serde::Serializer,
7    {
8        use serde::ser::SerializeStruct;
9        let len = 0;
10        let struct_ser = serializer.serialize_struct("serverless_backfill_controller.ProvisionRequest", len)?;
11        struct_ser.end()
12    }
13}
14impl<'de> serde::Deserialize<'de> for ProvisionRequest {
15    #[allow(deprecated)]
16    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17    where
18        D: serde::Deserializer<'de>,
19    {
20        const FIELDS: &[&str] = &[
21        ];
22
23        #[allow(clippy::enum_variant_names)]
24        enum GeneratedField {
25        }
26        impl<'de> serde::Deserialize<'de> for GeneratedField {
27            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
28            where
29                D: serde::Deserializer<'de>,
30            {
31                struct GeneratedVisitor;
32
33                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
34                    type Value = GeneratedField;
35
36                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
37                        write!(formatter, "expected one of: {:?}", &FIELDS)
38                    }
39
40                    #[allow(unused_variables)]
41                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
42                    where
43                        E: serde::de::Error,
44                    {
45                            Err(serde::de::Error::unknown_field(value, FIELDS))
46                    }
47                }
48                deserializer.deserialize_identifier(GeneratedVisitor)
49            }
50        }
51        struct GeneratedVisitor;
52        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
53            type Value = ProvisionRequest;
54
55            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
56                formatter.write_str("struct serverless_backfill_controller.ProvisionRequest")
57            }
58
59            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ProvisionRequest, V::Error>
60                where
61                    V: serde::de::MapAccess<'de>,
62            {
63                while map_.next_key::<GeneratedField>()?.is_some() {
64                    let _ = map_.next_value::<serde::de::IgnoredAny>()?;
65                }
66                Ok(ProvisionRequest {
67                })
68            }
69        }
70        deserializer.deserialize_struct("serverless_backfill_controller.ProvisionRequest", FIELDS, GeneratedVisitor)
71    }
72}
73impl serde::Serialize for ProvisionResponse {
74    #[allow(deprecated)]
75    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
76    where
77        S: serde::Serializer,
78    {
79        use serde::ser::SerializeStruct;
80        let mut len = 0;
81        if !self.resource_group.is_empty() {
82            len += 1;
83        }
84        let mut struct_ser = serializer.serialize_struct("serverless_backfill_controller.ProvisionResponse", len)?;
85        if !self.resource_group.is_empty() {
86            struct_ser.serialize_field("resourceGroup", &self.resource_group)?;
87        }
88        struct_ser.end()
89    }
90}
91impl<'de> serde::Deserialize<'de> for ProvisionResponse {
92    #[allow(deprecated)]
93    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
94    where
95        D: serde::Deserializer<'de>,
96    {
97        const FIELDS: &[&str] = &[
98            "resource_group",
99            "resourceGroup",
100        ];
101
102        #[allow(clippy::enum_variant_names)]
103        enum GeneratedField {
104            ResourceGroup,
105        }
106        impl<'de> serde::Deserialize<'de> for GeneratedField {
107            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
108            where
109                D: serde::Deserializer<'de>,
110            {
111                struct GeneratedVisitor;
112
113                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
114                    type Value = GeneratedField;
115
116                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
117                        write!(formatter, "expected one of: {:?}", &FIELDS)
118                    }
119
120                    #[allow(unused_variables)]
121                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
122                    where
123                        E: serde::de::Error,
124                    {
125                        match value {
126                            "resourceGroup" | "resource_group" => Ok(GeneratedField::ResourceGroup),
127                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
128                        }
129                    }
130                }
131                deserializer.deserialize_identifier(GeneratedVisitor)
132            }
133        }
134        struct GeneratedVisitor;
135        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
136            type Value = ProvisionResponse;
137
138            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
139                formatter.write_str("struct serverless_backfill_controller.ProvisionResponse")
140            }
141
142            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ProvisionResponse, V::Error>
143                where
144                    V: serde::de::MapAccess<'de>,
145            {
146                let mut resource_group__ = None;
147                while let Some(k) = map_.next_key()? {
148                    match k {
149                        GeneratedField::ResourceGroup => {
150                            if resource_group__.is_some() {
151                                return Err(serde::de::Error::duplicate_field("resourceGroup"));
152                            }
153                            resource_group__ = Some(map_.next_value()?);
154                        }
155                    }
156                }
157                Ok(ProvisionResponse {
158                    resource_group: resource_group__.unwrap_or_default(),
159                })
160            }
161        }
162        deserializer.deserialize_struct("serverless_backfill_controller.ProvisionResponse", FIELDS, GeneratedVisitor)
163    }
164}