Skip to main content

krabka_protocol/opt/rustwide/workdir/generated/
DescribeConfigsResponse.borrowed.rs

1// AUTO-GENERATED by krabka-protocol-codegen against a9ce3221537b8653448750697915607dc7936cf3. Do not edit.
2use bytes::BufMut;
3
4use crate::{
5    DecodeBorrow, Encode, ProtocolError, UnknownTaggedFields,
6    owned::describe_configs_response,
7    primitives::{
8        array::{array_len_prefix_len, get_array_len, put_array_len},
9        fixed::{get_bool, get_i8, get_i16, get_i32, put_bool, put_i8, put_i16, put_i32},
10        string_bytes::{
11            compact_nullable_string_len, compact_string_len, nullable_string_len,
12            put_compact_nullable_string, put_compact_string, put_nullable_string, put_string,
13            string_len,
14        },
15        string_bytes_borrowed::{
16            get_compact_nullable_string_borrowed, get_compact_string_borrowed,
17            get_nullable_string_borrowed, get_string_borrowed,
18        },
19    },
20    tagged_fields::{WriteTaggedFields, read_tagged_fields, tagged_fields_len},
21};
22pub const API_KEY: i16 = 32;
23pub const MIN_VERSION: i16 = 1;
24pub const MAX_VERSION: i16 = 4;
25pub const FLEXIBLE_MIN: i16 = 4;
26#[inline]
27#[must_use]
28pub fn is_flexible(version: i16) -> bool {
29    version >= FLEXIBLE_MIN
30}
31#[derive(Debug, Clone, PartialEq, Eq, Default)]
32pub struct DescribeConfigsResponse<'a> {
33    pub throttle_time_ms: i32,
34    pub results: Vec<DescribeConfigsResult<'a>>,
35    pub unknown_tagged_fields: UnknownTaggedFields,
36}
37impl DescribeConfigsResponse<'_> {
38    #[must_use]
39    pub fn to_owned(&self) -> describe_configs_response::DescribeConfigsResponse {
40        describe_configs_response::DescribeConfigsResponse {
41            throttle_time_ms: (self.throttle_time_ms),
42            results: (self.results)
43                .iter()
44                .map(DescribeConfigsResult::to_owned)
45                .collect(),
46            unknown_tagged_fields: self.unknown_tagged_fields.clone(),
47        }
48    }
49}
50impl Encode for DescribeConfigsResponse<'_> {
51    fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
52        if !(MIN_VERSION..=MAX_VERSION).contains(&version) {
53            return Err(ProtocolError::UnsupportedVersion {
54                api_key: API_KEY,
55                version,
56            });
57        }
58        let flex = is_flexible(version);
59        if version >= 0 {
60            put_i32(buf, self.throttle_time_ms);
61        }
62        if version >= 0 {
63            {
64                put_array_len(buf, (self.results).len(), flex)?;
65                for it in &self.results {
66                    it.encode(buf, version)?;
67                }
68            }
69        }
70        if flex {
71            let tagged = WriteTaggedFields::new();
72            tagged.write(buf, &self.unknown_tagged_fields)?;
73        }
74        Ok(())
75    }
76    fn encoded_len(&self, version: i16) -> usize {
77        let flex = is_flexible(version);
78        let mut n: usize = 0;
79        if version >= 0 {
80            n += 4;
81        }
82        if version >= 0 {
83            n += {
84                let prefix = array_len_prefix_len((self.results).len(), flex);
85                let body: usize = (self.results)
86                    .iter()
87                    .map(|it| it.encoded_len(version))
88                    .sum();
89                prefix + body
90            };
91        }
92        if flex {
93            let known_pairs: Vec<(u32, usize)> = Vec::new();
94            n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
95        }
96        n
97    }
98}
99impl<'de> DecodeBorrow<'de> for DescribeConfigsResponse<'de> {
100    fn decode_borrow(buf: &mut &'de [u8], version: i16) -> Result<Self, ProtocolError> {
101        if !(MIN_VERSION..=MAX_VERSION).contains(&version) {
102            return Err(ProtocolError::UnsupportedVersion {
103                api_key: API_KEY,
104                version,
105            });
106        }
107        let flex = is_flexible(version);
108        let mut out = Self::default();
109        if version >= 0 {
110            out.throttle_time_ms = get_i32(buf)?;
111        }
112        if version >= 0 {
113            out.results = {
114                let n = get_array_len(buf, flex)?;
115                let mut v = Vec::with_capacity(n);
116                for _ in 0..n {
117                    v.push(DescribeConfigsResult::decode_borrow(buf, version)?);
118                }
119                v
120            };
121        }
122        if flex {
123            out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
124        }
125        Ok(out)
126    }
127}
128#[cfg(test)]
129impl DescribeConfigsResponse<'_> {
130    #[must_use]
131    pub fn populated(version: i16) -> Self {
132        let mut m = Self::default();
133        if version >= 0 {
134            m.throttle_time_ms = 1i32;
135        }
136        if version >= 0 {
137            m.results = vec![DescribeConfigsResult::populated(version)];
138        }
139        m
140    }
141}
142#[derive(Debug, Clone, PartialEq, Eq)]
143pub struct DescribeConfigsResult<'a> {
144    pub error_code: i16,
145    pub error_message: Option<&'a str>,
146    pub resource_type: i8,
147    pub resource_name: &'a str,
148    pub configs: Vec<DescribeConfigsResourceResult<'a>>,
149    pub unknown_tagged_fields: UnknownTaggedFields,
150}
151impl Default for DescribeConfigsResult<'_> {
152    fn default() -> Self {
153        Self {
154            error_code: 0i16,
155            error_message: Some(""),
156            resource_type: 0i8,
157            resource_name: "",
158            configs: Vec::new(),
159            unknown_tagged_fields: UnknownTaggedFields::default(),
160        }
161    }
162}
163impl DescribeConfigsResult<'_> {
164    #[must_use]
165    pub fn to_owned(&self) -> describe_configs_response::DescribeConfigsResult {
166        describe_configs_response::DescribeConfigsResult {
167            error_code: (self.error_code),
168            error_message: (self.error_message).map(str::to_owned),
169            resource_type: (self.resource_type),
170            resource_name: (self.resource_name).to_owned(),
171            configs: (self.configs)
172                .iter()
173                .map(DescribeConfigsResourceResult::to_owned)
174                .collect(),
175            unknown_tagged_fields: self.unknown_tagged_fields.clone(),
176        }
177    }
178}
179impl Encode for DescribeConfigsResult<'_> {
180    fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
181        let flex = version >= 4;
182        if version >= 0 {
183            put_i16(buf, self.error_code);
184        }
185        if version >= 0 {
186            if flex {
187                put_compact_nullable_string(buf, self.error_message)?;
188            } else {
189                put_nullable_string(buf, self.error_message)?;
190            }
191        }
192        if version >= 0 {
193            put_i8(buf, self.resource_type);
194        }
195        if version >= 0 {
196            if flex {
197                put_compact_string(buf, self.resource_name)?;
198            } else {
199                put_string(buf, self.resource_name)?;
200            }
201        }
202        if version >= 0 {
203            {
204                put_array_len(buf, (self.configs).len(), flex)?;
205                for it in &self.configs {
206                    it.encode(buf, version)?;
207                }
208            }
209        }
210        if flex {
211            let tagged = WriteTaggedFields::new();
212            tagged.write(buf, &self.unknown_tagged_fields)?;
213        }
214        Ok(())
215    }
216    fn encoded_len(&self, version: i16) -> usize {
217        let flex = version >= 4;
218        let mut n: usize = 0;
219        if version >= 0 {
220            n += 2;
221        }
222        if version >= 0 {
223            n += if flex {
224                compact_nullable_string_len(self.error_message)
225            } else {
226                nullable_string_len(self.error_message)
227            };
228        }
229        if version >= 0 {
230            n += 1;
231        }
232        if version >= 0 {
233            n += if flex {
234                compact_string_len(self.resource_name)
235            } else {
236                string_len(self.resource_name)
237            };
238        }
239        if version >= 0 {
240            n += {
241                let prefix = array_len_prefix_len((self.configs).len(), flex);
242                let body: usize = (self.configs)
243                    .iter()
244                    .map(|it| it.encoded_len(version))
245                    .sum();
246                prefix + body
247            };
248        }
249        if flex {
250            let known_pairs: Vec<(u32, usize)> = Vec::new();
251            n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
252        }
253        n
254    }
255}
256impl<'de> DecodeBorrow<'de> for DescribeConfigsResult<'de> {
257    fn decode_borrow(buf: &mut &'de [u8], version: i16) -> Result<Self, ProtocolError> {
258        let flex = version >= 4;
259        let mut out = Self::default();
260        if version >= 0 {
261            out.error_code = get_i16(buf)?;
262        }
263        if version >= 0 {
264            out.error_message = if flex {
265                get_compact_nullable_string_borrowed(buf)?
266            } else {
267                get_nullable_string_borrowed(buf)?
268            };
269        }
270        if version >= 0 {
271            out.resource_type = get_i8(buf)?;
272        }
273        if version >= 0 {
274            out.resource_name = if flex {
275                get_compact_string_borrowed(buf)?
276            } else {
277                get_string_borrowed(buf)?
278            };
279        }
280        if version >= 0 {
281            out.configs = {
282                let n = get_array_len(buf, flex)?;
283                let mut v = Vec::with_capacity(n);
284                for _ in 0..n {
285                    v.push(DescribeConfigsResourceResult::decode_borrow(buf, version)?);
286                }
287                v
288            };
289        }
290        if flex {
291            out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
292        }
293        Ok(out)
294    }
295}
296#[cfg(test)]
297impl DescribeConfigsResult<'_> {
298    #[must_use]
299    pub fn populated(version: i16) -> Self {
300        let mut m = Self::default();
301        if version >= 0 {
302            m.error_code = 1i16;
303        }
304        if version >= 0 {
305            m.error_message = Some("x");
306        }
307        if version >= 0 {
308            m.resource_type = 1i8;
309        }
310        if version >= 0 {
311            m.resource_name = "x";
312        }
313        if version >= 0 {
314            m.configs = vec![DescribeConfigsResourceResult::populated(version)];
315        }
316        m
317    }
318}
319#[derive(Debug, Clone, PartialEq, Eq)]
320pub struct DescribeConfigsResourceResult<'a> {
321    pub name: &'a str,
322    pub value: Option<&'a str>,
323    pub read_only: bool,
324    pub config_source: i8,
325    pub is_sensitive: bool,
326    pub synonyms: Vec<DescribeConfigsSynonym<'a>>,
327    pub config_type: i8,
328    pub documentation: Option<&'a str>,
329    pub unknown_tagged_fields: UnknownTaggedFields,
330}
331impl Default for DescribeConfigsResourceResult<'_> {
332    fn default() -> Self {
333        Self {
334            name: "",
335            value: Some(""),
336            read_only: false,
337            config_source: -1i8,
338            is_sensitive: false,
339            synonyms: Vec::new(),
340            config_type: 0i8,
341            documentation: Some(""),
342            unknown_tagged_fields: UnknownTaggedFields::default(),
343        }
344    }
345}
346impl<'a> DescribeConfigsResourceResult<'a> {
347    #[must_use]
348    pub fn to_owned(&self) -> describe_configs_response::DescribeConfigsResourceResult {
349        describe_configs_response::DescribeConfigsResourceResult {
350            name: (self.name).to_owned(),
351            value: (self.value).map(str::to_owned),
352            read_only: (self.read_only),
353            config_source: (self.config_source),
354            is_sensitive: (self.is_sensitive),
355            synonyms: (self.synonyms)
356                .iter()
357                .map(DescribeConfigsSynonym::to_owned)
358                .collect(),
359            config_type: (self.config_type),
360            documentation: (self.documentation).map(str::to_owned),
361            unknown_tagged_fields: self.unknown_tagged_fields.clone(),
362        }
363    }
364    fn encode_field_0<B: BufMut>(
365        &self,
366        buf: &mut B,
367        version: i16,
368        flex: bool,
369    ) -> Result<(), ProtocolError> {
370        if version >= 0 {
371            if flex {
372                put_compact_string(buf, self.name)?;
373            } else {
374                put_string(buf, self.name)?;
375            }
376        }
377        Ok(())
378    }
379    fn encode_field_1<B: BufMut>(
380        &self,
381        buf: &mut B,
382        version: i16,
383        flex: bool,
384    ) -> Result<(), ProtocolError> {
385        if version >= 0 {
386            if flex {
387                put_compact_nullable_string(buf, self.value)?;
388            } else {
389                put_nullable_string(buf, self.value)?;
390            }
391        }
392        Ok(())
393    }
394    fn encode_field_2<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
395        if version >= 0 {
396            put_bool(buf, self.read_only);
397        }
398    }
399    fn encode_field_3<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
400        if version >= 1 {
401            put_i8(buf, self.config_source);
402        }
403    }
404    fn encode_field_4<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
405        if version >= 0 {
406            put_bool(buf, self.is_sensitive);
407        }
408    }
409    fn encode_field_5<B: BufMut>(
410        &self,
411        buf: &mut B,
412        version: i16,
413        flex: bool,
414    ) -> Result<(), ProtocolError> {
415        if version >= 1 {
416            {
417                put_array_len(buf, (self.synonyms).len(), flex)?;
418                for it in &self.synonyms {
419                    it.encode(buf, version)?;
420                }
421            }
422        }
423        Ok(())
424    }
425    fn encode_field_6<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
426        if version >= 3 {
427            put_i8(buf, self.config_type);
428        }
429    }
430    fn encode_field_7<B: BufMut>(
431        &self,
432        buf: &mut B,
433        version: i16,
434        flex: bool,
435    ) -> Result<(), ProtocolError> {
436        if version >= 3 {
437            if flex {
438                put_compact_nullable_string(buf, self.documentation)?;
439            } else {
440                put_nullable_string(buf, self.documentation)?;
441            }
442        }
443        Ok(())
444    }
445    fn encode_tagged_fields<B: BufMut>(
446        &self,
447        buf: &mut B,
448        _version: i16,
449        flex: bool,
450    ) -> Result<(), ProtocolError> {
451        if flex {
452            let tagged = WriteTaggedFields::new();
453            tagged.write(buf, &self.unknown_tagged_fields)?;
454        }
455        Ok(())
456    }
457    fn decode_field_0(
458        out: &mut Self,
459        buf: &mut &'a [u8],
460        version: i16,
461        flex: bool,
462    ) -> Result<(), ProtocolError> {
463        if version >= 0 {
464            out.name = if flex {
465                get_compact_string_borrowed(buf)?
466            } else {
467                get_string_borrowed(buf)?
468            };
469        }
470        Ok(())
471    }
472    fn decode_field_1(
473        out: &mut Self,
474        buf: &mut &'a [u8],
475        version: i16,
476        flex: bool,
477    ) -> Result<(), ProtocolError> {
478        if version >= 0 {
479            out.value = if flex {
480                get_compact_nullable_string_borrowed(buf)?
481            } else {
482                get_nullable_string_borrowed(buf)?
483            };
484        }
485        Ok(())
486    }
487    fn decode_field_2(
488        out: &mut Self,
489        buf: &mut &'a [u8],
490        version: i16,
491        _flex: bool,
492    ) -> Result<(), ProtocolError> {
493        if version >= 0 {
494            out.read_only = get_bool(buf)?;
495        }
496        Ok(())
497    }
498    fn decode_field_3(
499        out: &mut Self,
500        buf: &mut &'a [u8],
501        version: i16,
502        _flex: bool,
503    ) -> Result<(), ProtocolError> {
504        if version >= 1 {
505            out.config_source = get_i8(buf)?;
506        }
507        Ok(())
508    }
509    fn decode_field_4(
510        out: &mut Self,
511        buf: &mut &'a [u8],
512        version: i16,
513        _flex: bool,
514    ) -> Result<(), ProtocolError> {
515        if version >= 0 {
516            out.is_sensitive = get_bool(buf)?;
517        }
518        Ok(())
519    }
520    fn decode_field_5(
521        out: &mut Self,
522        buf: &mut &'a [u8],
523        version: i16,
524        flex: bool,
525    ) -> Result<(), ProtocolError> {
526        if version >= 1 {
527            out.synonyms = {
528                let n = get_array_len(buf, flex)?;
529                let mut v = Vec::with_capacity(n);
530                for _ in 0..n {
531                    v.push(DescribeConfigsSynonym::decode_borrow(buf, version)?);
532                }
533                v
534            };
535        }
536        Ok(())
537    }
538    fn decode_field_6(
539        out: &mut Self,
540        buf: &mut &'a [u8],
541        version: i16,
542        _flex: bool,
543    ) -> Result<(), ProtocolError> {
544        if version >= 3 {
545            out.config_type = get_i8(buf)?;
546        }
547        Ok(())
548    }
549    fn decode_field_7(
550        out: &mut Self,
551        buf: &mut &'a [u8],
552        version: i16,
553        flex: bool,
554    ) -> Result<(), ProtocolError> {
555        if version >= 3 {
556            out.documentation = if flex {
557                get_compact_nullable_string_borrowed(buf)?
558            } else {
559                get_nullable_string_borrowed(buf)?
560            };
561        }
562        Ok(())
563    }
564    fn decode_tagged_fields(
565        out: &mut Self,
566        buf: &mut &'a [u8],
567        _version: i16,
568        flex: bool,
569    ) -> Result<(), ProtocolError> {
570        if flex {
571            out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
572        }
573        Ok(())
574    }
575}
576impl Encode for DescribeConfigsResourceResult<'_> {
577    fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
578        let flex = version >= 4;
579        self.encode_field_0(buf, version, flex)?;
580        self.encode_field_1(buf, version, flex)?;
581        self.encode_field_2(buf, version, flex);
582        self.encode_field_3(buf, version, flex);
583        self.encode_field_4(buf, version, flex);
584        self.encode_field_5(buf, version, flex)?;
585        self.encode_field_6(buf, version, flex);
586        self.encode_field_7(buf, version, flex)?;
587        self.encode_tagged_fields(buf, version, flex)?;
588        Ok(())
589    }
590    fn encoded_len(&self, version: i16) -> usize {
591        let flex = version >= 4;
592        let mut n: usize = 0;
593        if version >= 0 {
594            n += if flex {
595                compact_string_len(self.name)
596            } else {
597                string_len(self.name)
598            };
599        }
600        if version >= 0 {
601            n += if flex {
602                compact_nullable_string_len(self.value)
603            } else {
604                nullable_string_len(self.value)
605            };
606        }
607        if version >= 0 {
608            n += 1;
609        }
610        if version >= 1 {
611            n += 1;
612        }
613        if version >= 0 {
614            n += 1;
615        }
616        if version >= 1 {
617            n += {
618                let prefix = array_len_prefix_len((self.synonyms).len(), flex);
619                let body: usize = (self.synonyms)
620                    .iter()
621                    .map(|it| it.encoded_len(version))
622                    .sum();
623                prefix + body
624            };
625        }
626        if version >= 3 {
627            n += 1;
628        }
629        if version >= 3 {
630            n += if flex {
631                compact_nullable_string_len(self.documentation)
632            } else {
633                nullable_string_len(self.documentation)
634            };
635        }
636        if flex {
637            let known_pairs: Vec<(u32, usize)> = Vec::new();
638            n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
639        }
640        n
641    }
642}
643impl<'de> DecodeBorrow<'de> for DescribeConfigsResourceResult<'de> {
644    fn decode_borrow(buf: &mut &'de [u8], version: i16) -> Result<Self, ProtocolError> {
645        let flex = version >= 4;
646        let mut out = Self::default();
647        Self::decode_field_0(&mut out, buf, version, flex)?;
648        Self::decode_field_1(&mut out, buf, version, flex)?;
649        Self::decode_field_2(&mut out, buf, version, flex)?;
650        Self::decode_field_3(&mut out, buf, version, flex)?;
651        Self::decode_field_4(&mut out, buf, version, flex)?;
652        Self::decode_field_5(&mut out, buf, version, flex)?;
653        Self::decode_field_6(&mut out, buf, version, flex)?;
654        Self::decode_field_7(&mut out, buf, version, flex)?;
655        Self::decode_tagged_fields(&mut out, buf, version, flex)?;
656        Ok(out)
657    }
658}
659#[cfg(test)]
660impl DescribeConfigsResourceResult<'_> {
661    #[must_use]
662    pub fn populated(version: i16) -> Self {
663        let mut m = Self::default();
664        if version >= 0 {
665            m.name = "x";
666        }
667        if version >= 0 {
668            m.value = Some("x");
669        }
670        if version >= 0 {
671            m.read_only = true;
672        }
673        if version >= 1 {
674            m.config_source = 1i8;
675        }
676        if version >= 0 {
677            m.is_sensitive = true;
678        }
679        if version >= 1 {
680            m.synonyms = vec![DescribeConfigsSynonym::populated(version)];
681        }
682        if version >= 3 {
683            m.config_type = 1i8;
684        }
685        if version >= 3 {
686            m.documentation = Some("x");
687        }
688        m
689    }
690}
691#[derive(Debug, Clone, PartialEq, Eq)]
692pub struct DescribeConfigsSynonym<'a> {
693    pub name: &'a str,
694    pub value: Option<&'a str>,
695    pub source: i8,
696    pub unknown_tagged_fields: UnknownTaggedFields,
697}
698impl Default for DescribeConfigsSynonym<'_> {
699    fn default() -> Self {
700        Self {
701            name: "",
702            value: Some(""),
703            source: 0i8,
704            unknown_tagged_fields: UnknownTaggedFields::default(),
705        }
706    }
707}
708impl DescribeConfigsSynonym<'_> {
709    #[must_use]
710    pub fn to_owned(&self) -> describe_configs_response::DescribeConfigsSynonym {
711        describe_configs_response::DescribeConfigsSynonym {
712            name: (self.name).to_owned(),
713            value: (self.value).map(str::to_owned),
714            source: (self.source),
715            unknown_tagged_fields: self.unknown_tagged_fields.clone(),
716        }
717    }
718}
719impl Encode for DescribeConfigsSynonym<'_> {
720    fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
721        let flex = version >= 4;
722        if version >= 1 {
723            if flex {
724                put_compact_string(buf, self.name)?;
725            } else {
726                put_string(buf, self.name)?;
727            }
728        }
729        if version >= 1 {
730            if flex {
731                put_compact_nullable_string(buf, self.value)?;
732            } else {
733                put_nullable_string(buf, self.value)?;
734            }
735        }
736        if version >= 1 {
737            put_i8(buf, self.source);
738        }
739        if flex {
740            let tagged = WriteTaggedFields::new();
741            tagged.write(buf, &self.unknown_tagged_fields)?;
742        }
743        Ok(())
744    }
745    fn encoded_len(&self, version: i16) -> usize {
746        let flex = version >= 4;
747        let mut n: usize = 0;
748        if version >= 1 {
749            n += if flex {
750                compact_string_len(self.name)
751            } else {
752                string_len(self.name)
753            };
754        }
755        if version >= 1 {
756            n += if flex {
757                compact_nullable_string_len(self.value)
758            } else {
759                nullable_string_len(self.value)
760            };
761        }
762        if version >= 1 {
763            n += 1;
764        }
765        if flex {
766            let known_pairs: Vec<(u32, usize)> = Vec::new();
767            n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
768        }
769        n
770    }
771}
772impl<'de> DecodeBorrow<'de> for DescribeConfigsSynonym<'de> {
773    fn decode_borrow(buf: &mut &'de [u8], version: i16) -> Result<Self, ProtocolError> {
774        let flex = version >= 4;
775        let mut out = Self::default();
776        if version >= 1 {
777            out.name = if flex {
778                get_compact_string_borrowed(buf)?
779            } else {
780                get_string_borrowed(buf)?
781            };
782        }
783        if version >= 1 {
784            out.value = if flex {
785                get_compact_nullable_string_borrowed(buf)?
786            } else {
787                get_nullable_string_borrowed(buf)?
788            };
789        }
790        if version >= 1 {
791            out.source = get_i8(buf)?;
792        }
793        if flex {
794            out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
795        }
796        Ok(out)
797    }
798}
799#[cfg(test)]
800impl DescribeConfigsSynonym<'_> {
801    #[must_use]
802    pub fn populated(version: i16) -> Self {
803        let mut m = Self::default();
804        if version >= 1 {
805            m.name = "x";
806        }
807        if version >= 1 {
808            m.value = Some("x");
809        }
810        if version >= 1 {
811            m.source = 1i8;
812        }
813        m
814    }
815}