kacrab_protocol/generated/
delete_share_group_state_response.rs1#![allow(
3 missing_docs,
4 clippy::all,
5 clippy::pedantic,
6 clippy::nursery,
7 clippy::arithmetic_side_effects,
8 reason = "Generated protocol modules mirror Kafka's schema shape and intentionally trade \
9 hand-written lint style for reproducible wire-code output."
10)]
11use bytes::{Bytes, BytesMut};
12
13use crate::*;
14
15#[derive(Debug, Clone, PartialEq)]
16pub struct DeleteShareGroupStateResponseData {
17 pub results: Vec<DeleteStateResult>,
19 pub _unknown_tagged_fields: Vec<RawTaggedField>,
20}
21impl Default for DeleteShareGroupStateResponseData {
22 fn default() -> Self {
23 Self {
24 results: Vec::new(),
25 _unknown_tagged_fields: Vec::new(),
26 }
27 }
28}
29impl DeleteShareGroupStateResponseData {
30 pub fn with_results(mut self, value: Vec<DeleteStateResult>) -> Self {
31 self.results = value;
32 self
33 }
34 pub fn read(buf: &mut Bytes, version: i16) -> Result<Self> {
35 if version < 0 || version > 0 {
36 return Err(UnsupportedVersion::new(86, version).into());
37 }
38 let results;
39 let mut _unknown_tagged_fields: Vec<RawTaggedField> = Vec::new();
40 results = {
41 let len = read_compact_array_length(buf)?;
42 let mut arr = Vec::with_capacity(array_read_capacity(len, (buf).len()));
43 for _ in 0..len {
44 arr.push(DeleteStateResult::read(buf, version)?);
45 }
46 arr
47 };
48 let tagged_fields = read_tagged_fields(buf)?;
49 for field in &tagged_fields {
50 match field.tag {
51 _ => {
52 _unknown_tagged_fields.push(field.clone());
53 },
54 }
55 }
56 Ok(Self {
57 results,
58 _unknown_tagged_fields,
59 })
60 }
61 pub fn write(&self, buf: &mut BytesMut, version: i16) -> Result<()> {
62 if version < 0 || version > 0 {
63 return Err(UnsupportedVersion::new(86, version).into());
64 }
65 write_compact_array_length(buf, self.results.len() as i32);
66 for el in &self.results {
67 el.write(buf, version)?;
68 }
69 let mut all_tags: Vec<RawTaggedField> = self._unknown_tagged_fields.clone();
70 all_tags.sort_by_key(|f| f.tag);
71 write_tagged_fields(buf, &all_tags)?;
72 Ok(())
73 }
74 pub fn encoded_len(&self, version: i16) -> Result<usize> {
75 if version < 0 || version > 0 {
76 return Err(UnsupportedVersion::new(86, version).into());
77 }
78 let mut len: usize = 0;
79 len += compact_array_length_len(self.results.len() as i32);
80 for el in &self.results {
81 len += el.encoded_len(version)?;
82 }
83 let mut all_tags: Vec<RawTaggedField> = self._unknown_tagged_fields.clone();
84 all_tags.sort_by_key(|f| f.tag);
85 len += tagged_fields_len(&all_tags)?;
86 Ok(len)
87 }
88}
89#[derive(Debug, Clone, PartialEq)]
90pub struct DeleteStateResult {
91 pub topic_id: KafkaUuid,
93 pub partitions: Vec<PartitionResult>,
95 pub _unknown_tagged_fields: Vec<RawTaggedField>,
96}
97impl Default for DeleteStateResult {
98 fn default() -> Self {
99 Self {
100 topic_id: KafkaUuid::ZERO,
101 partitions: Vec::new(),
102 _unknown_tagged_fields: Vec::new(),
103 }
104 }
105}
106impl DeleteStateResult {
107 pub fn with_topic_id(mut self, value: KafkaUuid) -> Self {
108 self.topic_id = value;
109 self
110 }
111 pub fn with_partitions(mut self, value: Vec<PartitionResult>) -> Self {
112 self.partitions = value;
113 self
114 }
115 pub fn read(buf: &mut Bytes, version: i16) -> Result<Self> {
116 let topic_id;
117 let partitions;
118 let mut _unknown_tagged_fields: Vec<RawTaggedField> = Vec::new();
119 topic_id = read_uuid(buf)?;
120 partitions = {
121 let len = read_compact_array_length(buf)?;
122 let mut arr = Vec::with_capacity(array_read_capacity(len, (buf).len()));
123 for _ in 0..len {
124 arr.push(PartitionResult::read(buf, version)?);
125 }
126 arr
127 };
128 let tagged_fields = read_tagged_fields(buf)?;
129 for field in &tagged_fields {
130 match field.tag {
131 _ => {
132 _unknown_tagged_fields.push(field.clone());
133 },
134 }
135 }
136 Ok(Self {
137 topic_id,
138 partitions,
139 _unknown_tagged_fields,
140 })
141 }
142 pub fn write(&self, buf: &mut BytesMut, version: i16) -> Result<()> {
143 write_uuid(buf, &self.topic_id);
144 write_compact_array_length(buf, self.partitions.len() as i32);
145 for el in &self.partitions {
146 el.write(buf, version)?;
147 }
148 let mut all_tags: Vec<RawTaggedField> = self._unknown_tagged_fields.clone();
149 all_tags.sort_by_key(|f| f.tag);
150 write_tagged_fields(buf, &all_tags)?;
151 Ok(())
152 }
153 pub fn encoded_len(&self, version: i16) -> Result<usize> {
154 let mut len: usize = 0;
155 len += 16;
156 len += compact_array_length_len(self.partitions.len() as i32);
157 for el in &self.partitions {
158 len += el.encoded_len(version)?;
159 }
160 let mut all_tags: Vec<RawTaggedField> = self._unknown_tagged_fields.clone();
161 all_tags.sort_by_key(|f| f.tag);
162 len += tagged_fields_len(&all_tags)?;
163 Ok(len)
164 }
165}
166#[derive(Debug, Clone, PartialEq)]
167pub struct PartitionResult {
168 pub partition: i32,
170 pub error_code: i16,
172 pub error_message: Option<KafkaString>,
174 pub _unknown_tagged_fields: Vec<RawTaggedField>,
175}
176impl Default for PartitionResult {
177 fn default() -> Self {
178 Self {
179 partition: 0_i32,
180 error_code: 0_i16,
181 error_message: None,
182 _unknown_tagged_fields: Vec::new(),
183 }
184 }
185}
186impl PartitionResult {
187 pub fn with_partition(mut self, value: i32) -> Self {
188 self.partition = value;
189 self
190 }
191 pub fn with_error_code(mut self, value: i16) -> Self {
192 self.error_code = value;
193 self
194 }
195 pub fn with_error_message(mut self, value: Option<KafkaString>) -> Self {
196 self.error_message = value;
197 self
198 }
199 pub fn read(buf: &mut Bytes, _version: i16) -> Result<Self> {
200 let partition;
201 let error_code;
202 let error_message;
203 let mut _unknown_tagged_fields: Vec<RawTaggedField> = Vec::new();
204 partition = read_i32(buf)?;
205 error_code = read_i16(buf)?;
206 error_message = read_compact_nullable_string(buf)?;
207 let tagged_fields = read_tagged_fields(buf)?;
208 for field in &tagged_fields {
209 match field.tag {
210 _ => {
211 _unknown_tagged_fields.push(field.clone());
212 },
213 }
214 }
215 Ok(Self {
216 partition,
217 error_code,
218 error_message,
219 _unknown_tagged_fields,
220 })
221 }
222 pub fn write(&self, buf: &mut BytesMut, _version: i16) -> Result<()> {
223 write_i32(buf, self.partition);
224 write_i16(buf, self.error_code);
225 write_compact_nullable_string(buf, self.error_message.as_ref())?;
226 let mut all_tags: Vec<RawTaggedField> = self._unknown_tagged_fields.clone();
227 all_tags.sort_by_key(|f| f.tag);
228 write_tagged_fields(buf, &all_tags)?;
229 Ok(())
230 }
231 pub fn encoded_len(&self, _version: i16) -> Result<usize> {
232 let mut len: usize = 0;
233 len += 4;
234 len += 2;
235 len += compact_nullable_string_len(self.error_message.as_ref())?;
236 let mut all_tags: Vec<RawTaggedField> = self._unknown_tagged_fields.clone();
237 all_tags.sort_by_key(|f| f.tag);
238 len += tagged_fields_len(&all_tags)?;
239 Ok(len)
240 }
241}