Skip to main content

krabka_protocol/opt/rustwide/workdir/generated/
StreamsGroupDescribeResponse.owned.rs

1// AUTO-GENERATED by krabka-protocol-codegen against a9ce3221537b8653448750697915607dc7936cf3. Do not edit.
2
3use bytes::{Buf, BufMut};
4
5use crate::{
6    Decode, Encode, ProtocolError, UnknownTaggedFields,
7    primitives::{
8        array::{
9            array_len_prefix_len, get_array_len, get_nullable_array_len,
10            nullable_array_len_prefix_len, put_array_len, put_nullable_array_len,
11        },
12        fixed::{get_bool, get_i8, get_i16, get_i32, put_bool, put_i8, put_i16, put_i32},
13        string_bytes::{
14            compact_nullable_string_len, compact_string_len, get_compact_nullable_string_owned,
15            get_compact_string_owned, get_nullable_string_owned, get_string_owned,
16            nullable_string_len, put_compact_nullable_string, put_compact_string,
17            put_nullable_string, put_string, string_len,
18        },
19    },
20    tagged_fields::{WriteTaggedFields, read_tagged_fields, tagged_fields_len},
21};
22pub const API_KEY: i16 = 89;
23pub const MIN_VERSION: i16 = 0;
24pub const MAX_VERSION: i16 = 1;
25pub const FLEXIBLE_MIN: i16 = 0;
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 StreamsGroupDescribeResponse {
33    pub throttle_time_ms: i32,
34    pub groups: Vec<DescribedGroup>,
35    pub unknown_tagged_fields: UnknownTaggedFields,
36}
37impl Encode for StreamsGroupDescribeResponse {
38    fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
39        if !(MIN_VERSION..=MAX_VERSION).contains(&version) {
40            return Err(ProtocolError::UnsupportedVersion {
41                api_key: API_KEY,
42                version,
43            });
44        }
45        let flex = is_flexible(version);
46        if version >= 0 {
47            put_i32(buf, self.throttle_time_ms);
48        }
49        if version >= 0 {
50            {
51                put_array_len(buf, (self.groups).len(), flex)?;
52                for it in &self.groups {
53                    it.encode(buf, version)?;
54                }
55            }
56        }
57        if flex {
58            let tagged = WriteTaggedFields::new();
59            tagged.write(buf, &self.unknown_tagged_fields)?;
60        }
61        Ok(())
62    }
63    fn encoded_len(&self, version: i16) -> usize {
64        let flex = is_flexible(version);
65        let mut n: usize = 0;
66        if version >= 0 {
67            n += 4;
68        }
69        if version >= 0 {
70            n += {
71                let prefix = array_len_prefix_len((self.groups).len(), flex);
72                let body: usize = (self.groups).iter().map(|it| it.encoded_len(version)).sum();
73                prefix + body
74            };
75        }
76        if flex {
77            let known_pairs: Vec<(u32, usize)> = Vec::new();
78            n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
79        }
80        n
81    }
82}
83impl Decode<'_> for StreamsGroupDescribeResponse {
84    fn decode<B: Buf>(buf: &mut B, version: i16) -> Result<Self, ProtocolError> {
85        if !(MIN_VERSION..=MAX_VERSION).contains(&version) {
86            return Err(ProtocolError::UnsupportedVersion {
87                api_key: API_KEY,
88                version,
89            });
90        }
91        let flex = is_flexible(version);
92        let mut out = Self::default();
93        if version >= 0 {
94            out.throttle_time_ms = get_i32(buf)?;
95        }
96        if version >= 0 {
97            out.groups = {
98                let n = get_array_len(buf, flex)?;
99                let mut v = Vec::with_capacity(n);
100                for _ in 0..n {
101                    v.push(DescribedGroup::decode(buf, version)?);
102                }
103                v
104            };
105        }
106        if flex {
107            out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
108        }
109        Ok(out)
110    }
111}
112#[cfg(test)]
113impl StreamsGroupDescribeResponse {
114    #[must_use]
115    pub fn populated(version: i16) -> Self {
116        let mut m = Self::default();
117        if version >= 0 {
118            m.throttle_time_ms = 1i32;
119        }
120        if version >= 0 {
121            m.groups = vec![DescribedGroup::populated(version)];
122        }
123        m
124    }
125}
126#[derive(Debug, Clone, PartialEq, Eq)]
127pub struct DescribedGroup {
128    pub error_code: i16,
129    pub error_message: Option<String>,
130    pub group_id: String,
131    pub group_state: String,
132    pub group_epoch: i32,
133    pub assignment_epoch: i32,
134    pub topology: Option<Topology>,
135    pub members: Vec<Member>,
136    pub authorized_operations: i32,
137    pub topology_description: Option<
138        super::common::streams_group_describe_response::topology_description::TopologyDescription,
139    >,
140    pub topology_description_status: i8,
141    pub assignor_name: Option<String>,
142    pub unknown_tagged_fields: UnknownTaggedFields,
143}
144impl Default for DescribedGroup {
145    fn default() -> Self {
146        Self {
147            error_code: 0i16,
148            error_message: None,
149            group_id: String::new(),
150            group_state: String::new(),
151            group_epoch: 0i32,
152            assignment_epoch: 0i32,
153            topology: None,
154            members: Vec::new(),
155            authorized_operations: -2_147_483_648i32,
156            topology_description: None,
157            topology_description_status: 0i8,
158            assignor_name: None,
159            unknown_tagged_fields: UnknownTaggedFields::default(),
160        }
161    }
162}
163impl DescribedGroup {
164    fn encode_field_0<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
165        if version >= 0 {
166            put_i16(buf, self.error_code);
167        }
168    }
169    fn encode_field_1<B: BufMut>(
170        &self,
171        buf: &mut B,
172        version: i16,
173        flex: bool,
174    ) -> Result<(), ProtocolError> {
175        if version >= 0 {
176            if flex {
177                put_compact_nullable_string(buf, self.error_message.as_deref())?;
178            } else {
179                put_nullable_string(buf, self.error_message.as_deref())?;
180            }
181        }
182        Ok(())
183    }
184    fn encode_field_2<B: BufMut>(
185        &self,
186        buf: &mut B,
187        version: i16,
188        flex: bool,
189    ) -> Result<(), ProtocolError> {
190        if version >= 0 {
191            if flex {
192                put_compact_string(buf, &self.group_id)?;
193            } else {
194                put_string(buf, &self.group_id)?;
195            }
196        }
197        Ok(())
198    }
199    fn encode_field_3<B: BufMut>(
200        &self,
201        buf: &mut B,
202        version: i16,
203        flex: bool,
204    ) -> Result<(), ProtocolError> {
205        if version >= 0 {
206            if flex {
207                put_compact_string(buf, &self.group_state)?;
208            } else {
209                put_string(buf, &self.group_state)?;
210            }
211        }
212        Ok(())
213    }
214    fn encode_field_4<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
215        if version >= 0 {
216            put_i32(buf, self.group_epoch);
217        }
218    }
219    fn encode_field_5<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
220        if version >= 0 {
221            put_i32(buf, self.assignment_epoch);
222        }
223    }
224    fn encode_field_6<B: BufMut>(
225        &self,
226        buf: &mut B,
227        version: i16,
228        _flex: bool,
229    ) -> Result<(), ProtocolError> {
230        if version >= 0 {
231            match &self.topology {
232                None => {
233                    buf.put_i8(-1);
234                }
235                Some(v) => {
236                    buf.put_i8(1);
237                    v.encode(buf, version)?;
238                }
239            }
240        }
241        Ok(())
242    }
243    fn encode_field_7<B: BufMut>(
244        &self,
245        buf: &mut B,
246        version: i16,
247        flex: bool,
248    ) -> Result<(), ProtocolError> {
249        if version >= 0 {
250            {
251                put_array_len(buf, (self.members).len(), flex)?;
252                for it in &self.members {
253                    it.encode(buf, version)?;
254                }
255            }
256        }
257        Ok(())
258    }
259    fn encode_field_8<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
260        if version >= 0 {
261            put_i32(buf, self.authorized_operations);
262        }
263    }
264    fn encode_field_9<B: BufMut>(
265        &self,
266        buf: &mut B,
267        version: i16,
268        _flex: bool,
269    ) -> Result<(), ProtocolError> {
270        if version >= 1 {
271            match &self.topology_description {
272                None => {
273                    buf.put_i8(-1);
274                }
275                Some(v) => {
276                    buf.put_i8(1);
277                    v.encode(buf, version)?;
278                }
279            }
280        }
281        Ok(())
282    }
283    fn encode_field_10<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
284        if version >= 1 {
285            put_i8(buf, self.topology_description_status);
286        }
287    }
288    fn encode_field_11<B: BufMut>(
289        &self,
290        buf: &mut B,
291        version: i16,
292        flex: bool,
293    ) -> Result<(), ProtocolError> {
294        if version >= 1 {
295            if flex {
296                put_compact_nullable_string(buf, self.assignor_name.as_deref())?;
297            } else {
298                put_nullable_string(buf, self.assignor_name.as_deref())?;
299            }
300        }
301        Ok(())
302    }
303    fn encode_tagged_fields<B: BufMut>(
304        &self,
305        buf: &mut B,
306        _version: i16,
307        flex: bool,
308    ) -> Result<(), ProtocolError> {
309        if flex {
310            let tagged = WriteTaggedFields::new();
311            tagged.write(buf, &self.unknown_tagged_fields)?;
312        }
313        Ok(())
314    }
315    fn decode_field_0<B: Buf>(
316        out: &mut Self,
317        buf: &mut B,
318        version: i16,
319        _flex: bool,
320    ) -> Result<(), ProtocolError> {
321        if version >= 0 {
322            out.error_code = get_i16(buf)?;
323        }
324        Ok(())
325    }
326    fn decode_field_1<B: Buf>(
327        out: &mut Self,
328        buf: &mut B,
329        version: i16,
330        flex: bool,
331    ) -> Result<(), ProtocolError> {
332        if version >= 0 {
333            out.error_message = if flex {
334                get_compact_nullable_string_owned(buf)?
335            } else {
336                get_nullable_string_owned(buf)?
337            };
338        }
339        Ok(())
340    }
341    fn decode_field_2<B: Buf>(
342        out: &mut Self,
343        buf: &mut B,
344        version: i16,
345        flex: bool,
346    ) -> Result<(), ProtocolError> {
347        if version >= 0 {
348            out.group_id = if flex {
349                get_compact_string_owned(buf)?
350            } else {
351                get_string_owned(buf)?
352            };
353        }
354        Ok(())
355    }
356    fn decode_field_3<B: Buf>(
357        out: &mut Self,
358        buf: &mut B,
359        version: i16,
360        flex: bool,
361    ) -> Result<(), ProtocolError> {
362        if version >= 0 {
363            out.group_state = if flex {
364                get_compact_string_owned(buf)?
365            } else {
366                get_string_owned(buf)?
367            };
368        }
369        Ok(())
370    }
371    fn decode_field_4<B: Buf>(
372        out: &mut Self,
373        buf: &mut B,
374        version: i16,
375        _flex: bool,
376    ) -> Result<(), ProtocolError> {
377        if version >= 0 {
378            out.group_epoch = get_i32(buf)?;
379        }
380        Ok(())
381    }
382    fn decode_field_5<B: Buf>(
383        out: &mut Self,
384        buf: &mut B,
385        version: i16,
386        _flex: bool,
387    ) -> Result<(), ProtocolError> {
388        if version >= 0 {
389            out.assignment_epoch = get_i32(buf)?;
390        }
391        Ok(())
392    }
393    fn decode_field_6<B: Buf>(
394        out: &mut Self,
395        buf: &mut B,
396        version: i16,
397        _flex: bool,
398    ) -> Result<(), ProtocolError> {
399        if version >= 0 {
400            out.topology = if get_i8(buf)? < 0 {
401                None
402            } else {
403                Some(Topology::decode(buf, version)?)
404            };
405        }
406        Ok(())
407    }
408    fn decode_field_7<B: Buf>(
409        out: &mut Self,
410        buf: &mut B,
411        version: i16,
412        flex: bool,
413    ) -> Result<(), ProtocolError> {
414        if version >= 0 {
415            out.members = {
416                let n = get_array_len(buf, flex)?;
417                let mut v = Vec::with_capacity(n);
418                for _ in 0..n {
419                    v.push(Member::decode(buf, version)?);
420                }
421                v
422            };
423        }
424        Ok(())
425    }
426    fn decode_field_8<B: Buf>(
427        out: &mut Self,
428        buf: &mut B,
429        version: i16,
430        _flex: bool,
431    ) -> Result<(), ProtocolError> {
432        if version >= 0 {
433            out.authorized_operations = get_i32(buf)?;
434        }
435        Ok(())
436    }
437    fn decode_field_9<B: Buf>(
438        out: &mut Self,
439        buf: &mut B,
440        version: i16,
441        _flex: bool,
442    ) -> Result<(), ProtocolError> {
443        if version >= 1 {
444            out.topology_description = if get_i8(buf)? < 0 {
445                None
446            } else {
447                Some(super::common::streams_group_describe_response::topology_description::TopologyDescription::decode(buf, version)?)
448            };
449        }
450        Ok(())
451    }
452    fn decode_field_10<B: Buf>(
453        out: &mut Self,
454        buf: &mut B,
455        version: i16,
456        _flex: bool,
457    ) -> Result<(), ProtocolError> {
458        if version >= 1 {
459            out.topology_description_status = get_i8(buf)?;
460        }
461        Ok(())
462    }
463    fn decode_field_11<B: Buf>(
464        out: &mut Self,
465        buf: &mut B,
466        version: i16,
467        flex: bool,
468    ) -> Result<(), ProtocolError> {
469        if version >= 1 {
470            out.assignor_name = if flex {
471                get_compact_nullable_string_owned(buf)?
472            } else {
473                get_nullable_string_owned(buf)?
474            };
475        }
476        Ok(())
477    }
478    fn decode_tagged_fields<B: Buf>(
479        out: &mut Self,
480        buf: &mut B,
481        _version: i16,
482        flex: bool,
483    ) -> Result<(), ProtocolError> {
484        if flex {
485            out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
486        }
487        Ok(())
488    }
489}
490impl Encode for DescribedGroup {
491    fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
492        let flex = version >= 0;
493        self.encode_field_0(buf, version, flex);
494        self.encode_field_1(buf, version, flex)?;
495        self.encode_field_2(buf, version, flex)?;
496        self.encode_field_3(buf, version, flex)?;
497        self.encode_field_4(buf, version, flex);
498        self.encode_field_5(buf, version, flex);
499        self.encode_field_6(buf, version, flex)?;
500        self.encode_field_7(buf, version, flex)?;
501        self.encode_field_8(buf, version, flex);
502        self.encode_field_9(buf, version, flex)?;
503        self.encode_field_10(buf, version, flex);
504        self.encode_field_11(buf, version, flex)?;
505        self.encode_tagged_fields(buf, version, flex)?;
506        Ok(())
507    }
508    fn encoded_len(&self, version: i16) -> usize {
509        let flex = version >= 0;
510        let mut n: usize = 0;
511        if version >= 0 {
512            n += 2;
513        }
514        if version >= 0 {
515            n += if flex {
516                compact_nullable_string_len(self.error_message.as_deref())
517            } else {
518                nullable_string_len(self.error_message.as_deref())
519            };
520        }
521        if version >= 0 {
522            n += if flex {
523                compact_string_len(&self.group_id)
524            } else {
525                string_len(&self.group_id)
526            };
527        }
528        if version >= 0 {
529            n += if flex {
530                compact_string_len(&self.group_state)
531            } else {
532                string_len(&self.group_state)
533            };
534        }
535        if version >= 0 {
536            n += 4;
537        }
538        if version >= 0 {
539            n += 4;
540        }
541        if version >= 0 {
542            n += 1 + self.topology.as_ref().map_or(0, |v| v.encoded_len(version));
543        }
544        if version >= 0 {
545            n += {
546                let prefix = array_len_prefix_len((self.members).len(), flex);
547                let body: usize = (self.members)
548                    .iter()
549                    .map(|it| it.encoded_len(version))
550                    .sum();
551                prefix + body
552            };
553        }
554        if version >= 0 {
555            n += 4;
556        }
557        if version >= 1 {
558            n += 1 + self
559                .topology_description
560                .as_ref()
561                .map_or(0, |v| v.encoded_len(version));
562        }
563        if version >= 1 {
564            n += 1;
565        }
566        if version >= 1 {
567            n += if flex {
568                compact_nullable_string_len(self.assignor_name.as_deref())
569            } else {
570                nullable_string_len(self.assignor_name.as_deref())
571            };
572        }
573        if flex {
574            let known_pairs: Vec<(u32, usize)> = Vec::new();
575            n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
576        }
577        n
578    }
579}
580impl Decode<'_> for DescribedGroup {
581    fn decode<B: Buf>(buf: &mut B, version: i16) -> Result<Self, ProtocolError> {
582        let flex = version >= 0;
583        let mut out = Self::default();
584        Self::decode_field_0(&mut out, buf, version, flex)?;
585        Self::decode_field_1(&mut out, buf, version, flex)?;
586        Self::decode_field_2(&mut out, buf, version, flex)?;
587        Self::decode_field_3(&mut out, buf, version, flex)?;
588        Self::decode_field_4(&mut out, buf, version, flex)?;
589        Self::decode_field_5(&mut out, buf, version, flex)?;
590        Self::decode_field_6(&mut out, buf, version, flex)?;
591        Self::decode_field_7(&mut out, buf, version, flex)?;
592        Self::decode_field_8(&mut out, buf, version, flex)?;
593        Self::decode_field_9(&mut out, buf, version, flex)?;
594        Self::decode_field_10(&mut out, buf, version, flex)?;
595        Self::decode_field_11(&mut out, buf, version, flex)?;
596        Self::decode_tagged_fields(&mut out, buf, version, flex)?;
597        Ok(out)
598    }
599}
600#[cfg(test)]
601impl DescribedGroup {
602    #[must_use]
603    pub fn populated(version: i16) -> Self {
604        let mut m = Self::default();
605        if version >= 0 {
606            m.error_code = 1i16;
607        }
608        if version >= 0 {
609            m.error_message = Some("x".to_owned());
610        }
611        if version >= 0 {
612            m.group_id = "x".to_owned();
613        }
614        if version >= 0 {
615            m.group_state = "x".to_owned();
616        }
617        if version >= 0 {
618            m.group_epoch = 1i32;
619        }
620        if version >= 0 {
621            m.assignment_epoch = 1i32;
622        }
623        if version >= 0 {
624            m.topology = Some(Topology::populated(version));
625        }
626        if version >= 0 {
627            m.members = vec![Member::populated(version)];
628        }
629        if version >= 0 {
630            m.authorized_operations = 1i32;
631        }
632        if version >= 1 {
633            m.topology_description = Some(super::common::streams_group_describe_response::topology_description::TopologyDescription::populated(version));
634        }
635        if version >= 1 {
636            m.topology_description_status = 1i8;
637        }
638        if version >= 1 {
639            m.assignor_name = Some("x".to_owned());
640        }
641        m
642    }
643}
644#[derive(Debug, Clone, PartialEq, Eq, Default)]
645pub struct Topology {
646    pub epoch: i32,
647    pub subtopologies: Option<Vec<Subtopology>>,
648    pub unknown_tagged_fields: UnknownTaggedFields,
649}
650impl Encode for Topology {
651    fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
652        let flex = version >= 0;
653        if version >= 0 {
654            put_i32(buf, self.epoch);
655        }
656        if version >= 0 {
657            {
658                let len = (self.subtopologies).as_ref().map(Vec::len);
659                put_nullable_array_len(buf, len, flex)?;
660                if let Some(v) = &self.subtopologies {
661                    for it in v {
662                        it.encode(buf, version)?;
663                    }
664                }
665            }
666        }
667        if flex {
668            let tagged = WriteTaggedFields::new();
669            tagged.write(buf, &self.unknown_tagged_fields)?;
670        }
671        Ok(())
672    }
673    fn encoded_len(&self, version: i16) -> usize {
674        let flex = version >= 0;
675        let mut n: usize = 0;
676        if version >= 0 {
677            n += 4;
678        }
679        if version >= 0 {
680            n += {
681                let opt: Option<&Vec<_>> = (self.subtopologies).as_ref();
682                let prefix = nullable_array_len_prefix_len(opt.map(Vec::len), flex);
683                let body: usize =
684                    opt.map_or(0, |v| v.iter().map(|it| it.encoded_len(version)).sum());
685                prefix + body
686            };
687        }
688        if flex {
689            let known_pairs: Vec<(u32, usize)> = Vec::new();
690            n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
691        }
692        n
693    }
694}
695impl Decode<'_> for Topology {
696    fn decode<B: Buf>(buf: &mut B, version: i16) -> Result<Self, ProtocolError> {
697        let flex = version >= 0;
698        let mut out = Self::default();
699        if version >= 0 {
700            out.epoch = get_i32(buf)?;
701        }
702        if version >= 0 {
703            out.subtopologies = {
704                let opt = get_nullable_array_len(buf, flex)?;
705                match opt {
706                    None => None,
707                    Some(n) => {
708                        let mut v = Vec::with_capacity(n);
709                        for _ in 0..n {
710                            v.push(Subtopology::decode(buf, version)?);
711                        }
712                        Some(v)
713                    }
714                }
715            };
716        }
717        if flex {
718            out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
719        }
720        Ok(out)
721    }
722}
723#[cfg(test)]
724impl Topology {
725    #[must_use]
726    pub fn populated(version: i16) -> Self {
727        let mut m = Self::default();
728        if version >= 0 {
729            m.epoch = 1i32;
730        }
731        if version >= 0 {
732            m.subtopologies = Some(vec![Subtopology::populated(version)]);
733        }
734        m
735    }
736}
737#[derive(Debug, Clone, PartialEq, Eq, Default)]
738pub struct Subtopology {
739    pub subtopology_id: String,
740    pub source_topics: Vec<String>,
741    pub repartition_sink_topics: Vec<String>,
742    pub state_changelog_topics:
743        Vec<super::common::streams_group_describe_response::topic_info::TopicInfo>,
744    pub repartition_source_topics:
745        Vec<super::common::streams_group_describe_response::topic_info::TopicInfo>,
746    pub unknown_tagged_fields: UnknownTaggedFields,
747}
748impl Encode for Subtopology {
749    fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
750        let flex = version >= 0;
751        if version >= 0 {
752            if flex {
753                put_compact_string(buf, &self.subtopology_id)?;
754            } else {
755                put_string(buf, &self.subtopology_id)?;
756            }
757        }
758        if version >= 0 {
759            {
760                put_array_len(buf, (self.source_topics).len(), flex)?;
761                for it in &self.source_topics {
762                    if flex {
763                        put_compact_string(buf, it)?;
764                    } else {
765                        put_string(buf, it)?;
766                    }
767                }
768            }
769        }
770        if version >= 0 {
771            {
772                put_array_len(buf, (self.repartition_sink_topics).len(), flex)?;
773                for it in &self.repartition_sink_topics {
774                    if flex {
775                        put_compact_string(buf, it)?;
776                    } else {
777                        put_string(buf, it)?;
778                    }
779                }
780            }
781        }
782        if version >= 0 {
783            {
784                put_array_len(buf, (self.state_changelog_topics).len(), flex)?;
785                for it in &self.state_changelog_topics {
786                    it.encode(buf, version)?;
787                }
788            }
789        }
790        if version >= 0 {
791            {
792                put_array_len(buf, (self.repartition_source_topics).len(), flex)?;
793                for it in &self.repartition_source_topics {
794                    it.encode(buf, version)?;
795                }
796            }
797        }
798        if flex {
799            let tagged = WriteTaggedFields::new();
800            tagged.write(buf, &self.unknown_tagged_fields)?;
801        }
802        Ok(())
803    }
804    fn encoded_len(&self, version: i16) -> usize {
805        let flex = version >= 0;
806        let mut n: usize = 0;
807        if version >= 0 {
808            n += if flex {
809                compact_string_len(&self.subtopology_id)
810            } else {
811                string_len(&self.subtopology_id)
812            };
813        }
814        if version >= 0 {
815            n += {
816                let prefix = array_len_prefix_len((self.source_topics).len(), flex);
817                let body: usize = (self.source_topics)
818                    .iter()
819                    .map(|it| {
820                        if flex {
821                            compact_string_len(it)
822                        } else {
823                            string_len(it)
824                        }
825                    })
826                    .sum();
827                prefix + body
828            };
829        }
830        if version >= 0 {
831            n += {
832                let prefix = array_len_prefix_len((self.repartition_sink_topics).len(), flex);
833                let body: usize = (self.repartition_sink_topics)
834                    .iter()
835                    .map(|it| {
836                        if flex {
837                            compact_string_len(it)
838                        } else {
839                            string_len(it)
840                        }
841                    })
842                    .sum();
843                prefix + body
844            };
845        }
846        if version >= 0 {
847            n += {
848                let prefix = array_len_prefix_len((self.state_changelog_topics).len(), flex);
849                let body: usize = (self.state_changelog_topics)
850                    .iter()
851                    .map(|it| it.encoded_len(version))
852                    .sum();
853                prefix + body
854            };
855        }
856        if version >= 0 {
857            n += {
858                let prefix = array_len_prefix_len((self.repartition_source_topics).len(), flex);
859                let body: usize = (self.repartition_source_topics)
860                    .iter()
861                    .map(|it| it.encoded_len(version))
862                    .sum();
863                prefix + body
864            };
865        }
866        if flex {
867            let known_pairs: Vec<(u32, usize)> = Vec::new();
868            n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
869        }
870        n
871    }
872}
873impl Decode<'_> for Subtopology {
874    fn decode<B: Buf>(buf: &mut B, version: i16) -> Result<Self, ProtocolError> {
875        let flex = version >= 0;
876        let mut out = Self::default();
877        if version >= 0 {
878            out.subtopology_id = if flex {
879                get_compact_string_owned(buf)?
880            } else {
881                get_string_owned(buf)?
882            };
883        }
884        if version >= 0 {
885            out.source_topics = {
886                let n = get_array_len(buf, flex)?;
887                let mut v = Vec::with_capacity(n);
888                for _ in 0..n {
889                    v.push(if flex {
890                        get_compact_string_owned(buf)?
891                    } else {
892                        get_string_owned(buf)?
893                    });
894                }
895                v
896            };
897        }
898        if version >= 0 {
899            out.repartition_sink_topics = {
900                let n = get_array_len(buf, flex)?;
901                let mut v = Vec::with_capacity(n);
902                for _ in 0..n {
903                    v.push(if flex {
904                        get_compact_string_owned(buf)?
905                    } else {
906                        get_string_owned(buf)?
907                    });
908                }
909                v
910            };
911        }
912        if version >= 0 {
913            out.state_changelog_topics = {
914                let n = get_array_len(buf, flex)?;
915                let mut v = Vec::with_capacity(n);
916                for _ in 0..n {
917                    v.push(super::common::streams_group_describe_response::topic_info::TopicInfo::decode(buf, version)?);
918                }
919                v
920            };
921        }
922        if version >= 0 {
923            out.repartition_source_topics = {
924                let n = get_array_len(buf, flex)?;
925                let mut v = Vec::with_capacity(n);
926                for _ in 0..n {
927                    v.push(super::common::streams_group_describe_response::topic_info::TopicInfo::decode(buf, version)?);
928                }
929                v
930            };
931        }
932        if flex {
933            out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
934        }
935        Ok(out)
936    }
937}
938#[cfg(test)]
939impl Subtopology {
940    #[must_use]
941    pub fn populated(version: i16) -> Self {
942        let mut m = Self::default();
943        if version >= 0 {
944            m.subtopology_id = "x".to_owned();
945        }
946        if version >= 0 {
947            m.source_topics = vec!["x".to_owned()];
948        }
949        if version >= 0 {
950            m.repartition_sink_topics = vec!["x".to_owned()];
951        }
952        if version >= 0 {
953            m.state_changelog_topics = vec![
954                super::common::streams_group_describe_response::topic_info::TopicInfo::populated(
955                    version,
956                ),
957            ];
958        }
959        if version >= 0 {
960            m.repartition_source_topics = vec![
961                super::common::streams_group_describe_response::topic_info::TopicInfo::populated(
962                    version,
963                ),
964            ];
965        }
966        m
967    }
968}
969#[derive(Debug, Clone, PartialEq, Eq, Default)]
970pub struct Member {
971    pub member_id: String,
972    pub member_epoch: i32,
973    pub instance_id: Option<String>,
974    pub rack_id: Option<String>,
975    pub client_id: String,
976    pub client_host: String,
977    pub topology_epoch: i32,
978    pub process_id: String,
979    pub user_endpoint: Option<super::common::streams_group_describe_response::endpoint::Endpoint>,
980    pub client_tags: Vec<super::common::streams_group_describe_response::key_value::KeyValue>,
981    pub task_offsets: Vec<super::common::streams_group_describe_response::task_offset::TaskOffset>,
982    pub task_end_offsets:
983        Vec<super::common::streams_group_describe_response::task_offset::TaskOffset>,
984    pub assignment: super::common::streams_group_describe_response::assignment::Assignment,
985    pub target_assignment: super::common::streams_group_describe_response::assignment::Assignment,
986    pub is_classic: bool,
987    pub unknown_tagged_fields: UnknownTaggedFields,
988}
989impl Member {
990    fn encode_field_0<B: BufMut>(
991        &self,
992        buf: &mut B,
993        version: i16,
994        flex: bool,
995    ) -> Result<(), ProtocolError> {
996        if version >= 0 {
997            if flex {
998                put_compact_string(buf, &self.member_id)?;
999            } else {
1000                put_string(buf, &self.member_id)?;
1001            }
1002        }
1003        Ok(())
1004    }
1005    fn encode_field_1<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
1006        if version >= 0 {
1007            put_i32(buf, self.member_epoch);
1008        }
1009    }
1010    fn encode_field_2<B: BufMut>(
1011        &self,
1012        buf: &mut B,
1013        version: i16,
1014        flex: bool,
1015    ) -> Result<(), ProtocolError> {
1016        if version >= 0 {
1017            if flex {
1018                put_compact_nullable_string(buf, self.instance_id.as_deref())?;
1019            } else {
1020                put_nullable_string(buf, self.instance_id.as_deref())?;
1021            }
1022        }
1023        Ok(())
1024    }
1025    fn encode_field_3<B: BufMut>(
1026        &self,
1027        buf: &mut B,
1028        version: i16,
1029        flex: bool,
1030    ) -> Result<(), ProtocolError> {
1031        if version >= 0 {
1032            if flex {
1033                put_compact_nullable_string(buf, self.rack_id.as_deref())?;
1034            } else {
1035                put_nullable_string(buf, self.rack_id.as_deref())?;
1036            }
1037        }
1038        Ok(())
1039    }
1040    fn encode_field_4<B: BufMut>(
1041        &self,
1042        buf: &mut B,
1043        version: i16,
1044        flex: bool,
1045    ) -> Result<(), ProtocolError> {
1046        if version >= 0 {
1047            if flex {
1048                put_compact_string(buf, &self.client_id)?;
1049            } else {
1050                put_string(buf, &self.client_id)?;
1051            }
1052        }
1053        Ok(())
1054    }
1055    fn encode_field_5<B: BufMut>(
1056        &self,
1057        buf: &mut B,
1058        version: i16,
1059        flex: bool,
1060    ) -> Result<(), ProtocolError> {
1061        if version >= 0 {
1062            if flex {
1063                put_compact_string(buf, &self.client_host)?;
1064            } else {
1065                put_string(buf, &self.client_host)?;
1066            }
1067        }
1068        Ok(())
1069    }
1070    fn encode_field_6<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
1071        if version >= 0 {
1072            put_i32(buf, self.topology_epoch);
1073        }
1074    }
1075    fn encode_field_7<B: BufMut>(
1076        &self,
1077        buf: &mut B,
1078        version: i16,
1079        flex: bool,
1080    ) -> Result<(), ProtocolError> {
1081        if version >= 0 {
1082            if flex {
1083                put_compact_string(buf, &self.process_id)?;
1084            } else {
1085                put_string(buf, &self.process_id)?;
1086            }
1087        }
1088        Ok(())
1089    }
1090    fn encode_field_8<B: BufMut>(
1091        &self,
1092        buf: &mut B,
1093        version: i16,
1094        _flex: bool,
1095    ) -> Result<(), ProtocolError> {
1096        if version >= 0 {
1097            match &self.user_endpoint {
1098                None => {
1099                    buf.put_i8(-1);
1100                }
1101                Some(v) => {
1102                    buf.put_i8(1);
1103                    v.encode(buf, version)?;
1104                }
1105            }
1106        }
1107        Ok(())
1108    }
1109    fn encode_field_9<B: BufMut>(
1110        &self,
1111        buf: &mut B,
1112        version: i16,
1113        flex: bool,
1114    ) -> Result<(), ProtocolError> {
1115        if version >= 0 {
1116            {
1117                put_array_len(buf, (self.client_tags).len(), flex)?;
1118                for it in &self.client_tags {
1119                    it.encode(buf, version)?;
1120                }
1121            }
1122        }
1123        Ok(())
1124    }
1125    fn encode_field_10<B: BufMut>(
1126        &self,
1127        buf: &mut B,
1128        version: i16,
1129        flex: bool,
1130    ) -> Result<(), ProtocolError> {
1131        if version >= 0 {
1132            {
1133                put_array_len(buf, (self.task_offsets).len(), flex)?;
1134                for it in &self.task_offsets {
1135                    it.encode(buf, version)?;
1136                }
1137            }
1138        }
1139        Ok(())
1140    }
1141    fn encode_field_11<B: BufMut>(
1142        &self,
1143        buf: &mut B,
1144        version: i16,
1145        flex: bool,
1146    ) -> Result<(), ProtocolError> {
1147        if version >= 0 {
1148            {
1149                put_array_len(buf, (self.task_end_offsets).len(), flex)?;
1150                for it in &self.task_end_offsets {
1151                    it.encode(buf, version)?;
1152                }
1153            }
1154        }
1155        Ok(())
1156    }
1157    fn encode_field_12<B: BufMut>(
1158        &self,
1159        buf: &mut B,
1160        version: i16,
1161        _flex: bool,
1162    ) -> Result<(), ProtocolError> {
1163        if version >= 0 {
1164            self.assignment.encode(buf, version)?;
1165        }
1166        Ok(())
1167    }
1168    fn encode_field_13<B: BufMut>(
1169        &self,
1170        buf: &mut B,
1171        version: i16,
1172        _flex: bool,
1173    ) -> Result<(), ProtocolError> {
1174        if version >= 0 {
1175            self.target_assignment.encode(buf, version)?;
1176        }
1177        Ok(())
1178    }
1179    fn encode_field_14<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
1180        if version >= 0 {
1181            put_bool(buf, self.is_classic);
1182        }
1183    }
1184    fn encode_tagged_fields<B: BufMut>(
1185        &self,
1186        buf: &mut B,
1187        _version: i16,
1188        flex: bool,
1189    ) -> Result<(), ProtocolError> {
1190        if flex {
1191            let tagged = WriteTaggedFields::new();
1192            tagged.write(buf, &self.unknown_tagged_fields)?;
1193        }
1194        Ok(())
1195    }
1196    fn decode_field_0<B: Buf>(
1197        out: &mut Self,
1198        buf: &mut B,
1199        version: i16,
1200        flex: bool,
1201    ) -> Result<(), ProtocolError> {
1202        if version >= 0 {
1203            out.member_id = if flex {
1204                get_compact_string_owned(buf)?
1205            } else {
1206                get_string_owned(buf)?
1207            };
1208        }
1209        Ok(())
1210    }
1211    fn decode_field_1<B: Buf>(
1212        out: &mut Self,
1213        buf: &mut B,
1214        version: i16,
1215        _flex: bool,
1216    ) -> Result<(), ProtocolError> {
1217        if version >= 0 {
1218            out.member_epoch = get_i32(buf)?;
1219        }
1220        Ok(())
1221    }
1222    fn decode_field_2<B: Buf>(
1223        out: &mut Self,
1224        buf: &mut B,
1225        version: i16,
1226        flex: bool,
1227    ) -> Result<(), ProtocolError> {
1228        if version >= 0 {
1229            out.instance_id = if flex {
1230                get_compact_nullable_string_owned(buf)?
1231            } else {
1232                get_nullable_string_owned(buf)?
1233            };
1234        }
1235        Ok(())
1236    }
1237    fn decode_field_3<B: Buf>(
1238        out: &mut Self,
1239        buf: &mut B,
1240        version: i16,
1241        flex: bool,
1242    ) -> Result<(), ProtocolError> {
1243        if version >= 0 {
1244            out.rack_id = if flex {
1245                get_compact_nullable_string_owned(buf)?
1246            } else {
1247                get_nullable_string_owned(buf)?
1248            };
1249        }
1250        Ok(())
1251    }
1252    fn decode_field_4<B: Buf>(
1253        out: &mut Self,
1254        buf: &mut B,
1255        version: i16,
1256        flex: bool,
1257    ) -> Result<(), ProtocolError> {
1258        if version >= 0 {
1259            out.client_id = if flex {
1260                get_compact_string_owned(buf)?
1261            } else {
1262                get_string_owned(buf)?
1263            };
1264        }
1265        Ok(())
1266    }
1267    fn decode_field_5<B: Buf>(
1268        out: &mut Self,
1269        buf: &mut B,
1270        version: i16,
1271        flex: bool,
1272    ) -> Result<(), ProtocolError> {
1273        if version >= 0 {
1274            out.client_host = if flex {
1275                get_compact_string_owned(buf)?
1276            } else {
1277                get_string_owned(buf)?
1278            };
1279        }
1280        Ok(())
1281    }
1282    fn decode_field_6<B: Buf>(
1283        out: &mut Self,
1284        buf: &mut B,
1285        version: i16,
1286        _flex: bool,
1287    ) -> Result<(), ProtocolError> {
1288        if version >= 0 {
1289            out.topology_epoch = get_i32(buf)?;
1290        }
1291        Ok(())
1292    }
1293    fn decode_field_7<B: Buf>(
1294        out: &mut Self,
1295        buf: &mut B,
1296        version: i16,
1297        flex: bool,
1298    ) -> Result<(), ProtocolError> {
1299        if version >= 0 {
1300            out.process_id = if flex {
1301                get_compact_string_owned(buf)?
1302            } else {
1303                get_string_owned(buf)?
1304            };
1305        }
1306        Ok(())
1307    }
1308    fn decode_field_8<B: Buf>(
1309        out: &mut Self,
1310        buf: &mut B,
1311        version: i16,
1312        _flex: bool,
1313    ) -> Result<(), ProtocolError> {
1314        if version >= 0 {
1315            out.user_endpoint = if get_i8(buf)? < 0 {
1316                None
1317            } else {
1318                Some(
1319                    super::common::streams_group_describe_response::endpoint::Endpoint::decode(
1320                        buf, version,
1321                    )?,
1322                )
1323            };
1324        }
1325        Ok(())
1326    }
1327    fn decode_field_9<B: Buf>(
1328        out: &mut Self,
1329        buf: &mut B,
1330        version: i16,
1331        flex: bool,
1332    ) -> Result<(), ProtocolError> {
1333        if version >= 0 {
1334            out.client_tags = {
1335                let n = get_array_len(buf, flex)?;
1336                let mut v = Vec::with_capacity(n);
1337                for _ in 0..n {
1338                    v.push(super::common::streams_group_describe_response::key_value::KeyValue::decode(buf, version)?);
1339                }
1340                v
1341            };
1342        }
1343        Ok(())
1344    }
1345    fn decode_field_10<B: Buf>(
1346        out: &mut Self,
1347        buf: &mut B,
1348        version: i16,
1349        flex: bool,
1350    ) -> Result<(), ProtocolError> {
1351        if version >= 0 {
1352            out.task_offsets = {
1353                let n = get_array_len(buf, flex)?;
1354                let mut v = Vec::with_capacity(n);
1355                for _ in 0..n {
1356                    v.push(super::common::streams_group_describe_response::task_offset::TaskOffset::decode(buf, version)?);
1357                }
1358                v
1359            };
1360        }
1361        Ok(())
1362    }
1363    fn decode_field_11<B: Buf>(
1364        out: &mut Self,
1365        buf: &mut B,
1366        version: i16,
1367        flex: bool,
1368    ) -> Result<(), ProtocolError> {
1369        if version >= 0 {
1370            out.task_end_offsets = {
1371                let n = get_array_len(buf, flex)?;
1372                let mut v = Vec::with_capacity(n);
1373                for _ in 0..n {
1374                    v.push(super::common::streams_group_describe_response::task_offset::TaskOffset::decode(buf, version)?);
1375                }
1376                v
1377            };
1378        }
1379        Ok(())
1380    }
1381    fn decode_field_12<B: Buf>(
1382        out: &mut Self,
1383        buf: &mut B,
1384        version: i16,
1385        _flex: bool,
1386    ) -> Result<(), ProtocolError> {
1387        if version >= 0 {
1388            out.assignment =
1389                super::common::streams_group_describe_response::assignment::Assignment::decode(
1390                    buf, version,
1391                )?;
1392        }
1393        Ok(())
1394    }
1395    fn decode_field_13<B: Buf>(
1396        out: &mut Self,
1397        buf: &mut B,
1398        version: i16,
1399        _flex: bool,
1400    ) -> Result<(), ProtocolError> {
1401        if version >= 0 {
1402            out.target_assignment =
1403                super::common::streams_group_describe_response::assignment::Assignment::decode(
1404                    buf, version,
1405                )?;
1406        }
1407        Ok(())
1408    }
1409    fn decode_field_14<B: Buf>(
1410        out: &mut Self,
1411        buf: &mut B,
1412        version: i16,
1413        _flex: bool,
1414    ) -> Result<(), ProtocolError> {
1415        if version >= 0 {
1416            out.is_classic = get_bool(buf)?;
1417        }
1418        Ok(())
1419    }
1420    fn decode_tagged_fields<B: Buf>(
1421        out: &mut Self,
1422        buf: &mut B,
1423        _version: i16,
1424        flex: bool,
1425    ) -> Result<(), ProtocolError> {
1426        if flex {
1427            out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
1428        }
1429        Ok(())
1430    }
1431}
1432impl Encode for Member {
1433    fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
1434        let flex = version >= 0;
1435        self.encode_field_0(buf, version, flex)?;
1436        self.encode_field_1(buf, version, flex);
1437        self.encode_field_2(buf, version, flex)?;
1438        self.encode_field_3(buf, version, flex)?;
1439        self.encode_field_4(buf, version, flex)?;
1440        self.encode_field_5(buf, version, flex)?;
1441        self.encode_field_6(buf, version, flex);
1442        self.encode_field_7(buf, version, flex)?;
1443        self.encode_field_8(buf, version, flex)?;
1444        self.encode_field_9(buf, version, flex)?;
1445        self.encode_field_10(buf, version, flex)?;
1446        self.encode_field_11(buf, version, flex)?;
1447        self.encode_field_12(buf, version, flex)?;
1448        self.encode_field_13(buf, version, flex)?;
1449        self.encode_field_14(buf, version, flex);
1450        self.encode_tagged_fields(buf, version, flex)?;
1451        Ok(())
1452    }
1453    fn encoded_len(&self, version: i16) -> usize {
1454        let flex = version >= 0;
1455        let mut n: usize = 0;
1456        if version >= 0 {
1457            n += if flex {
1458                compact_string_len(&self.member_id)
1459            } else {
1460                string_len(&self.member_id)
1461            };
1462        }
1463        if version >= 0 {
1464            n += 4;
1465        }
1466        if version >= 0 {
1467            n += if flex {
1468                compact_nullable_string_len(self.instance_id.as_deref())
1469            } else {
1470                nullable_string_len(self.instance_id.as_deref())
1471            };
1472        }
1473        if version >= 0 {
1474            n += if flex {
1475                compact_nullable_string_len(self.rack_id.as_deref())
1476            } else {
1477                nullable_string_len(self.rack_id.as_deref())
1478            };
1479        }
1480        if version >= 0 {
1481            n += if flex {
1482                compact_string_len(&self.client_id)
1483            } else {
1484                string_len(&self.client_id)
1485            };
1486        }
1487        if version >= 0 {
1488            n += if flex {
1489                compact_string_len(&self.client_host)
1490            } else {
1491                string_len(&self.client_host)
1492            };
1493        }
1494        if version >= 0 {
1495            n += 4;
1496        }
1497        if version >= 0 {
1498            n += if flex {
1499                compact_string_len(&self.process_id)
1500            } else {
1501                string_len(&self.process_id)
1502            };
1503        }
1504        if version >= 0 {
1505            n += 1 + self
1506                .user_endpoint
1507                .as_ref()
1508                .map_or(0, |v| v.encoded_len(version));
1509        }
1510        if version >= 0 {
1511            n += {
1512                let prefix = array_len_prefix_len((self.client_tags).len(), flex);
1513                let body: usize = (self.client_tags)
1514                    .iter()
1515                    .map(|it| it.encoded_len(version))
1516                    .sum();
1517                prefix + body
1518            };
1519        }
1520        if version >= 0 {
1521            n += {
1522                let prefix = array_len_prefix_len((self.task_offsets).len(), flex);
1523                let body: usize = (self.task_offsets)
1524                    .iter()
1525                    .map(|it| it.encoded_len(version))
1526                    .sum();
1527                prefix + body
1528            };
1529        }
1530        if version >= 0 {
1531            n += {
1532                let prefix = array_len_prefix_len((self.task_end_offsets).len(), flex);
1533                let body: usize = (self.task_end_offsets)
1534                    .iter()
1535                    .map(|it| it.encoded_len(version))
1536                    .sum();
1537                prefix + body
1538            };
1539        }
1540        if version >= 0 {
1541            n += self.assignment.encoded_len(version);
1542        }
1543        if version >= 0 {
1544            n += self.target_assignment.encoded_len(version);
1545        }
1546        if version >= 0 {
1547            n += 1;
1548        }
1549        if flex {
1550            let known_pairs: Vec<(u32, usize)> = Vec::new();
1551            n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
1552        }
1553        n
1554    }
1555}
1556impl Decode<'_> for Member {
1557    fn decode<B: Buf>(buf: &mut B, version: i16) -> Result<Self, ProtocolError> {
1558        let flex = version >= 0;
1559        let mut out = Self::default();
1560        Self::decode_field_0(&mut out, buf, version, flex)?;
1561        Self::decode_field_1(&mut out, buf, version, flex)?;
1562        Self::decode_field_2(&mut out, buf, version, flex)?;
1563        Self::decode_field_3(&mut out, buf, version, flex)?;
1564        Self::decode_field_4(&mut out, buf, version, flex)?;
1565        Self::decode_field_5(&mut out, buf, version, flex)?;
1566        Self::decode_field_6(&mut out, buf, version, flex)?;
1567        Self::decode_field_7(&mut out, buf, version, flex)?;
1568        Self::decode_field_8(&mut out, buf, version, flex)?;
1569        Self::decode_field_9(&mut out, buf, version, flex)?;
1570        Self::decode_field_10(&mut out, buf, version, flex)?;
1571        Self::decode_field_11(&mut out, buf, version, flex)?;
1572        Self::decode_field_12(&mut out, buf, version, flex)?;
1573        Self::decode_field_13(&mut out, buf, version, flex)?;
1574        Self::decode_field_14(&mut out, buf, version, flex)?;
1575        Self::decode_tagged_fields(&mut out, buf, version, flex)?;
1576        Ok(out)
1577    }
1578}
1579#[cfg(test)]
1580impl Member {
1581    #[must_use]
1582    pub fn populated(version: i16) -> Self {
1583        let mut m = Self::default();
1584        if version >= 0 {
1585            m.member_id = "x".to_owned();
1586        }
1587        if version >= 0 {
1588            m.member_epoch = 1i32;
1589        }
1590        if version >= 0 {
1591            m.instance_id = Some("x".to_owned());
1592        }
1593        if version >= 0 {
1594            m.rack_id = Some("x".to_owned());
1595        }
1596        if version >= 0 {
1597            m.client_id = "x".to_owned();
1598        }
1599        if version >= 0 {
1600            m.client_host = "x".to_owned();
1601        }
1602        if version >= 0 {
1603            m.topology_epoch = 1i32;
1604        }
1605        if version >= 0 {
1606            m.process_id = "x".to_owned();
1607        }
1608        if version >= 0 {
1609            m.user_endpoint = Some(
1610                super::common::streams_group_describe_response::endpoint::Endpoint::populated(
1611                    version,
1612                ),
1613            );
1614        }
1615        if version >= 0 {
1616            m.client_tags = vec![
1617                super::common::streams_group_describe_response::key_value::KeyValue::populated(
1618                    version,
1619                ),
1620            ];
1621        }
1622        if version >= 0 {
1623            m.task_offsets = vec![
1624                super::common::streams_group_describe_response::task_offset::TaskOffset::populated(
1625                    version,
1626                ),
1627            ];
1628        }
1629        if version >= 0 {
1630            m.task_end_offsets = vec![
1631                super::common::streams_group_describe_response::task_offset::TaskOffset::populated(
1632                    version,
1633                ),
1634            ];
1635        }
1636        if version >= 0 {
1637            m.assignment =
1638                super::common::streams_group_describe_response::assignment::Assignment::populated(
1639                    version,
1640                );
1641        }
1642        if version >= 0 {
1643            m.target_assignment =
1644                super::common::streams_group_describe_response::assignment::Assignment::populated(
1645                    version,
1646                );
1647        }
1648        if version >= 0 {
1649            m.is_classic = true;
1650        }
1651        m
1652    }
1653}
1654/// Default JSON payload matching `Self::default()` for JVM oracle differential testing.
1655/// Only includes fields valid for the given version.
1656#[must_use]
1657#[allow(unused_comparisons)]
1658pub fn default_json(_version: i16) -> ::serde_json::Value {
1659    let mut obj = ::serde_json::Map::new();
1660    obj.insert("throttleTimeMs".to_owned(), ::serde_json::json!(0));
1661    obj.insert("groups".to_owned(), ::serde_json::Value::Array(vec![]));
1662    ::serde_json::Value::Object(obj)
1663}