risingwave_pb/
compute.serde.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
use crate::compute::*;
impl serde::Serialize for ShowConfigRequest {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let len = 0;
        let struct_ser = serializer.serialize_struct("compute.ShowConfigRequest", len)?;
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for ShowConfigRequest {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                            Err(serde::de::Error::unknown_field(value, FIELDS))
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = ShowConfigRequest;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct compute.ShowConfigRequest")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ShowConfigRequest, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                while map_.next_key::<GeneratedField>()?.is_some() {
                    let _ = map_.next_value::<serde::de::IgnoredAny>()?;
                }
                Ok(ShowConfigRequest {
                })
            }
        }
        deserializer.deserialize_struct("compute.ShowConfigRequest", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for ShowConfigResponse {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.batch_config.is_empty() {
            len += 1;
        }
        if !self.stream_config.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("compute.ShowConfigResponse", len)?;
        if !self.batch_config.is_empty() {
            struct_ser.serialize_field("batchConfig", &self.batch_config)?;
        }
        if !self.stream_config.is_empty() {
            struct_ser.serialize_field("streamConfig", &self.stream_config)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for ShowConfigResponse {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "batch_config",
            "batchConfig",
            "stream_config",
            "streamConfig",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            BatchConfig,
            StreamConfig,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "batchConfig" | "batch_config" => Ok(GeneratedField::BatchConfig),
                            "streamConfig" | "stream_config" => Ok(GeneratedField::StreamConfig),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = ShowConfigResponse;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct compute.ShowConfigResponse")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ShowConfigResponse, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut batch_config__ = None;
                let mut stream_config__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::BatchConfig => {
                            if batch_config__.is_some() {
                                return Err(serde::de::Error::duplicate_field("batchConfig"));
                            }
                            batch_config__ = Some(map_.next_value()?);
                        }
                        GeneratedField::StreamConfig => {
                            if stream_config__.is_some() {
                                return Err(serde::de::Error::duplicate_field("streamConfig"));
                            }
                            stream_config__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(ShowConfigResponse {
                    batch_config: batch_config__.unwrap_or_default(),
                    stream_config: stream_config__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("compute.ShowConfigResponse", FIELDS, GeneratedVisitor)
    }
}