1#![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 StreamsGroupHeartbeatResponseData {
17 pub throttle_time_ms: i32,
20 pub error_code: i16,
22 pub error_message: Option<KafkaString>,
24 pub member_id: KafkaString,
26 pub member_epoch: i32,
28 pub heartbeat_interval_ms: i32,
30 pub acceptable_recovery_lag: i32,
32 pub task_offset_interval_ms: i32,
35 pub status: Option<Vec<Status>>,
37 pub active_tasks: Option<Vec<TaskIds>>,
39 pub standby_tasks: Option<Vec<TaskIds>>,
41 pub warmup_tasks: Option<Vec<TaskIds>>,
43 pub endpoint_information_epoch: i32,
45 pub partitions_by_user_endpoint: Option<Vec<EndpointToPartitions>>,
47 pub _unknown_tagged_fields: Vec<RawTaggedField>,
48}
49impl Default for StreamsGroupHeartbeatResponseData {
50 fn default() -> Self {
51 Self {
52 throttle_time_ms: 0_i32,
53 error_code: 0_i16,
54 error_message: None,
55 member_id: KafkaString::default(),
56 member_epoch: 0_i32,
57 heartbeat_interval_ms: 0_i32,
58 acceptable_recovery_lag: 0_i32,
59 task_offset_interval_ms: 0_i32,
60 status: None,
61 active_tasks: None,
62 standby_tasks: None,
63 warmup_tasks: None,
64 endpoint_information_epoch: 0_i32,
65 partitions_by_user_endpoint: None,
66 _unknown_tagged_fields: Vec::new(),
67 }
68 }
69}
70impl StreamsGroupHeartbeatResponseData {
71 pub fn with_throttle_time_ms(mut self, value: i32) -> Self {
72 self.throttle_time_ms = value;
73 self
74 }
75 pub fn with_error_code(mut self, value: i16) -> Self {
76 self.error_code = value;
77 self
78 }
79 pub fn with_error_message(mut self, value: Option<KafkaString>) -> Self {
80 self.error_message = value;
81 self
82 }
83 pub fn with_member_id(mut self, value: KafkaString) -> Self {
84 self.member_id = value;
85 self
86 }
87 pub fn with_member_epoch(mut self, value: i32) -> Self {
88 self.member_epoch = value;
89 self
90 }
91 pub fn with_heartbeat_interval_ms(mut self, value: i32) -> Self {
92 self.heartbeat_interval_ms = value;
93 self
94 }
95 pub fn with_acceptable_recovery_lag(mut self, value: i32) -> Self {
96 self.acceptable_recovery_lag = value;
97 self
98 }
99 pub fn with_task_offset_interval_ms(mut self, value: i32) -> Self {
100 self.task_offset_interval_ms = value;
101 self
102 }
103 pub fn with_status(mut self, value: Option<Vec<Status>>) -> Self {
104 self.status = value;
105 self
106 }
107 pub fn with_active_tasks(mut self, value: Option<Vec<TaskIds>>) -> Self {
108 self.active_tasks = value;
109 self
110 }
111 pub fn with_standby_tasks(mut self, value: Option<Vec<TaskIds>>) -> Self {
112 self.standby_tasks = value;
113 self
114 }
115 pub fn with_warmup_tasks(mut self, value: Option<Vec<TaskIds>>) -> Self {
116 self.warmup_tasks = value;
117 self
118 }
119 pub fn with_endpoint_information_epoch(mut self, value: i32) -> Self {
120 self.endpoint_information_epoch = value;
121 self
122 }
123 pub fn with_partitions_by_user_endpoint(
124 mut self,
125 value: Option<Vec<EndpointToPartitions>>,
126 ) -> Self {
127 self.partitions_by_user_endpoint = value;
128 self
129 }
130 pub fn read(buf: &mut Bytes, version: i16) -> Result<Self> {
131 if version < 0 || version > 0 {
132 return Err(UnsupportedVersion::new(88, version).into());
133 }
134 let throttle_time_ms;
135 let error_code;
136 let error_message;
137 let member_id;
138 let member_epoch;
139 let heartbeat_interval_ms;
140 let acceptable_recovery_lag;
141 let task_offset_interval_ms;
142 let status;
143 let active_tasks;
144 let standby_tasks;
145 let warmup_tasks;
146 let endpoint_information_epoch;
147 let partitions_by_user_endpoint;
148 let mut _unknown_tagged_fields: Vec<RawTaggedField> = Vec::new();
149 throttle_time_ms = read_i32(buf)?;
150 error_code = read_i16(buf)?;
151 error_message = read_compact_nullable_string(buf)?;
152 member_id = read_compact_string(buf)?;
153 member_epoch = read_i32(buf)?;
154 heartbeat_interval_ms = read_i32(buf)?;
155 acceptable_recovery_lag = read_i32(buf)?;
156 task_offset_interval_ms = read_i32(buf)?;
157 status = {
158 let len = read_compact_array_length(buf)?;
159 if len < 0 {
160 None
161 } else {
162 let mut arr = Vec::with_capacity(array_read_capacity(len, (buf).len()));
163 for _ in 0..len {
164 arr.push(Status::read(buf, version)?);
165 }
166 Some(arr)
167 }
168 };
169 active_tasks = {
170 let len = read_compact_array_length(buf)?;
171 if len < 0 {
172 None
173 } else {
174 let mut arr = Vec::with_capacity(array_read_capacity(len, (buf).len()));
175 for _ in 0..len {
176 arr.push(TaskIds::read(buf, version)?);
177 }
178 Some(arr)
179 }
180 };
181 standby_tasks = {
182 let len = read_compact_array_length(buf)?;
183 if len < 0 {
184 None
185 } else {
186 let mut arr = Vec::with_capacity(array_read_capacity(len, (buf).len()));
187 for _ in 0..len {
188 arr.push(TaskIds::read(buf, version)?);
189 }
190 Some(arr)
191 }
192 };
193 warmup_tasks = {
194 let len = read_compact_array_length(buf)?;
195 if len < 0 {
196 None
197 } else {
198 let mut arr = Vec::with_capacity(array_read_capacity(len, (buf).len()));
199 for _ in 0..len {
200 arr.push(TaskIds::read(buf, version)?);
201 }
202 Some(arr)
203 }
204 };
205 endpoint_information_epoch = read_i32(buf)?;
206 partitions_by_user_endpoint = {
207 let len = read_compact_array_length(buf)?;
208 if len < 0 {
209 None
210 } else {
211 let mut arr = Vec::with_capacity(array_read_capacity(len, (buf).len()));
212 for _ in 0..len {
213 arr.push(EndpointToPartitions::read(buf, version)?);
214 }
215 Some(arr)
216 }
217 };
218 let tagged_fields = read_tagged_fields(buf)?;
219 for field in &tagged_fields {
220 match field.tag {
221 _ => {
222 _unknown_tagged_fields.push(field.clone());
223 },
224 }
225 }
226 Ok(Self {
227 throttle_time_ms,
228 error_code,
229 error_message,
230 member_id,
231 member_epoch,
232 heartbeat_interval_ms,
233 acceptable_recovery_lag,
234 task_offset_interval_ms,
235 status,
236 active_tasks,
237 standby_tasks,
238 warmup_tasks,
239 endpoint_information_epoch,
240 partitions_by_user_endpoint,
241 _unknown_tagged_fields,
242 })
243 }
244 pub fn write(&self, buf: &mut BytesMut, version: i16) -> Result<()> {
245 if version < 0 || version > 0 {
246 return Err(UnsupportedVersion::new(88, version).into());
247 }
248 write_i32(buf, self.throttle_time_ms);
249 write_i16(buf, self.error_code);
250 write_compact_nullable_string(buf, self.error_message.as_ref())?;
251 write_compact_string(buf, &self.member_id)?;
252 write_i32(buf, self.member_epoch);
253 write_i32(buf, self.heartbeat_interval_ms);
254 write_i32(buf, self.acceptable_recovery_lag);
255 write_i32(buf, self.task_offset_interval_ms);
256 match &self.status {
257 None => {
258 write_compact_array_length(buf, -1);
259 },
260 Some(arr) => {
261 write_compact_array_length(buf, arr.len() as i32);
262 for el in arr {
263 el.write(buf, version)?;
264 }
265 },
266 }
267 match &self.active_tasks {
268 None => {
269 write_compact_array_length(buf, -1);
270 },
271 Some(arr) => {
272 write_compact_array_length(buf, arr.len() as i32);
273 for el in arr {
274 el.write(buf, version)?;
275 }
276 },
277 }
278 match &self.standby_tasks {
279 None => {
280 write_compact_array_length(buf, -1);
281 },
282 Some(arr) => {
283 write_compact_array_length(buf, arr.len() as i32);
284 for el in arr {
285 el.write(buf, version)?;
286 }
287 },
288 }
289 match &self.warmup_tasks {
290 None => {
291 write_compact_array_length(buf, -1);
292 },
293 Some(arr) => {
294 write_compact_array_length(buf, arr.len() as i32);
295 for el in arr {
296 el.write(buf, version)?;
297 }
298 },
299 }
300 write_i32(buf, self.endpoint_information_epoch);
301 match &self.partitions_by_user_endpoint {
302 None => {
303 write_compact_array_length(buf, -1);
304 },
305 Some(arr) => {
306 write_compact_array_length(buf, arr.len() as i32);
307 for el in arr {
308 el.write(buf, version)?;
309 }
310 },
311 }
312 let mut all_tags: Vec<RawTaggedField> = self._unknown_tagged_fields.clone();
313 all_tags.sort_by_key(|f| f.tag);
314 write_tagged_fields(buf, &all_tags)?;
315 Ok(())
316 }
317 pub fn encoded_len(&self, version: i16) -> Result<usize> {
318 if version < 0 || version > 0 {
319 return Err(UnsupportedVersion::new(88, version).into());
320 }
321 let mut len: usize = 0;
322 len += 4;
323 len += 2;
324 len += compact_nullable_string_len(self.error_message.as_ref())?;
325 len += compact_string_len(&self.member_id)?;
326 len += 4;
327 len += 4;
328 len += 4;
329 len += 4;
330 match &self.status {
331 None => {
332 len += compact_array_length_len(-1);
333 },
334 Some(arr) => {
335 len += compact_array_length_len(arr.len() as i32);
336 for el in arr {
337 len += el.encoded_len(version)?;
338 }
339 },
340 }
341 match &self.active_tasks {
342 None => {
343 len += compact_array_length_len(-1);
344 },
345 Some(arr) => {
346 len += compact_array_length_len(arr.len() as i32);
347 for el in arr {
348 len += el.encoded_len(version)?;
349 }
350 },
351 }
352 match &self.standby_tasks {
353 None => {
354 len += compact_array_length_len(-1);
355 },
356 Some(arr) => {
357 len += compact_array_length_len(arr.len() as i32);
358 for el in arr {
359 len += el.encoded_len(version)?;
360 }
361 },
362 }
363 match &self.warmup_tasks {
364 None => {
365 len += compact_array_length_len(-1);
366 },
367 Some(arr) => {
368 len += compact_array_length_len(arr.len() as i32);
369 for el in arr {
370 len += el.encoded_len(version)?;
371 }
372 },
373 }
374 len += 4;
375 match &self.partitions_by_user_endpoint {
376 None => {
377 len += compact_array_length_len(-1);
378 },
379 Some(arr) => {
380 len += compact_array_length_len(arr.len() as i32);
381 for el in arr {
382 len += el.encoded_len(version)?;
383 }
384 },
385 }
386 let mut all_tags: Vec<RawTaggedField> = self._unknown_tagged_fields.clone();
387 all_tags.sort_by_key(|f| f.tag);
388 len += tagged_fields_len(&all_tags)?;
389 Ok(len)
390 }
391}
392#[derive(Debug, Clone, PartialEq)]
393pub struct EndpointToPartitions {
394 pub user_endpoint: Endpoint,
396 pub active_partitions: Vec<TopicPartition>,
398 pub standby_partitions: Vec<TopicPartition>,
400 pub _unknown_tagged_fields: Vec<RawTaggedField>,
401}
402impl Default for EndpointToPartitions {
403 fn default() -> Self {
404 Self {
405 user_endpoint: Endpoint::default(),
406 active_partitions: Vec::new(),
407 standby_partitions: Vec::new(),
408 _unknown_tagged_fields: Vec::new(),
409 }
410 }
411}
412impl EndpointToPartitions {
413 pub fn with_user_endpoint(mut self, value: Endpoint) -> Self {
414 self.user_endpoint = value;
415 self
416 }
417 pub fn with_active_partitions(mut self, value: Vec<TopicPartition>) -> Self {
418 self.active_partitions = value;
419 self
420 }
421 pub fn with_standby_partitions(mut self, value: Vec<TopicPartition>) -> Self {
422 self.standby_partitions = value;
423 self
424 }
425 pub fn read(buf: &mut Bytes, version: i16) -> Result<Self> {
426 let user_endpoint;
427 let active_partitions;
428 let standby_partitions;
429 let mut _unknown_tagged_fields: Vec<RawTaggedField> = Vec::new();
430 user_endpoint = Endpoint::read(buf, version)?;
431 active_partitions = {
432 let len = read_compact_array_length(buf)?;
433 let mut arr = Vec::with_capacity(array_read_capacity(len, (buf).len()));
434 for _ in 0..len {
435 arr.push(TopicPartition::read(buf, version)?);
436 }
437 arr
438 };
439 standby_partitions = {
440 let len = read_compact_array_length(buf)?;
441 let mut arr = Vec::with_capacity(array_read_capacity(len, (buf).len()));
442 for _ in 0..len {
443 arr.push(TopicPartition::read(buf, version)?);
444 }
445 arr
446 };
447 let tagged_fields = read_tagged_fields(buf)?;
448 for field in &tagged_fields {
449 match field.tag {
450 _ => {
451 _unknown_tagged_fields.push(field.clone());
452 },
453 }
454 }
455 Ok(Self {
456 user_endpoint,
457 active_partitions,
458 standby_partitions,
459 _unknown_tagged_fields,
460 })
461 }
462 pub fn write(&self, buf: &mut BytesMut, version: i16) -> Result<()> {
463 self.user_endpoint.write(buf, version)?;
464 write_compact_array_length(buf, self.active_partitions.len() as i32);
465 for el in &self.active_partitions {
466 el.write(buf, version)?;
467 }
468 write_compact_array_length(buf, self.standby_partitions.len() as i32);
469 for el in &self.standby_partitions {
470 el.write(buf, version)?;
471 }
472 let mut all_tags: Vec<RawTaggedField> = self._unknown_tagged_fields.clone();
473 all_tags.sort_by_key(|f| f.tag);
474 write_tagged_fields(buf, &all_tags)?;
475 Ok(())
476 }
477 pub fn encoded_len(&self, version: i16) -> Result<usize> {
478 let mut len: usize = 0;
479 len += self.user_endpoint.encoded_len(version)?;
480 len += compact_array_length_len(self.active_partitions.len() as i32);
481 for el in &self.active_partitions {
482 len += el.encoded_len(version)?;
483 }
484 len += compact_array_length_len(self.standby_partitions.len() as i32);
485 for el in &self.standby_partitions {
486 len += el.encoded_len(version)?;
487 }
488 let mut all_tags: Vec<RawTaggedField> = self._unknown_tagged_fields.clone();
489 all_tags.sort_by_key(|f| f.tag);
490 len += tagged_fields_len(&all_tags)?;
491 Ok(len)
492 }
493}
494#[derive(Debug, Clone, PartialEq)]
495pub struct Status {
496 pub status_code: i8,
498 pub status_detail: KafkaString,
500 pub _unknown_tagged_fields: Vec<RawTaggedField>,
501}
502impl Default for Status {
503 fn default() -> Self {
504 Self {
505 status_code: 0_i8,
506 status_detail: KafkaString::default(),
507 _unknown_tagged_fields: Vec::new(),
508 }
509 }
510}
511impl Status {
512 pub fn with_status_code(mut self, value: i8) -> Self {
513 self.status_code = value;
514 self
515 }
516 pub fn with_status_detail(mut self, value: KafkaString) -> Self {
517 self.status_detail = value;
518 self
519 }
520 pub fn read(buf: &mut Bytes, _version: i16) -> Result<Self> {
521 let status_code;
522 let status_detail;
523 let mut _unknown_tagged_fields: Vec<RawTaggedField> = Vec::new();
524 status_code = read_i8(buf)?;
525 status_detail = read_compact_string(buf)?;
526 let tagged_fields = read_tagged_fields(buf)?;
527 for field in &tagged_fields {
528 match field.tag {
529 _ => {
530 _unknown_tagged_fields.push(field.clone());
531 },
532 }
533 }
534 Ok(Self {
535 status_code,
536 status_detail,
537 _unknown_tagged_fields,
538 })
539 }
540 pub fn write(&self, buf: &mut BytesMut, _version: i16) -> Result<()> {
541 write_i8(buf, self.status_code);
542 write_compact_string(buf, &self.status_detail)?;
543 let mut all_tags: Vec<RawTaggedField> = self._unknown_tagged_fields.clone();
544 all_tags.sort_by_key(|f| f.tag);
545 write_tagged_fields(buf, &all_tags)?;
546 Ok(())
547 }
548 pub fn encoded_len(&self, _version: i16) -> Result<usize> {
549 let mut len: usize = 0;
550 len += 1;
551 len += compact_string_len(&self.status_detail)?;
552 let mut all_tags: Vec<RawTaggedField> = self._unknown_tagged_fields.clone();
553 all_tags.sort_by_key(|f| f.tag);
554 len += tagged_fields_len(&all_tags)?;
555 Ok(len)
556 }
557}
558#[derive(Debug, Clone, PartialEq)]
559pub struct TopicPartition {
560 pub topic: KafkaString,
562 pub partitions: Vec<i32>,
564 pub _unknown_tagged_fields: Vec<RawTaggedField>,
565}
566impl Default for TopicPartition {
567 fn default() -> Self {
568 Self {
569 topic: KafkaString::default(),
570 partitions: Vec::new(),
571 _unknown_tagged_fields: Vec::new(),
572 }
573 }
574}
575impl TopicPartition {
576 pub fn with_topic(mut self, value: KafkaString) -> Self {
577 self.topic = value;
578 self
579 }
580 pub fn with_partitions(mut self, value: Vec<i32>) -> Self {
581 self.partitions = value;
582 self
583 }
584 pub fn read(buf: &mut Bytes, _version: i16) -> Result<Self> {
585 let topic;
586 let partitions;
587 let mut _unknown_tagged_fields: Vec<RawTaggedField> = Vec::new();
588 topic = read_compact_string(buf)?;
589 partitions = {
590 let len = read_compact_array_length(buf)?;
591 let mut arr = Vec::with_capacity(array_read_capacity(len, (buf).len()));
592 for _ in 0..len {
593 arr.push(read_i32(buf)?);
594 }
595 arr
596 };
597 let tagged_fields = read_tagged_fields(buf)?;
598 for field in &tagged_fields {
599 match field.tag {
600 _ => {
601 _unknown_tagged_fields.push(field.clone());
602 },
603 }
604 }
605 Ok(Self {
606 topic,
607 partitions,
608 _unknown_tagged_fields,
609 })
610 }
611 pub fn write(&self, buf: &mut BytesMut, _version: i16) -> Result<()> {
612 write_compact_string(buf, &self.topic)?;
613 write_compact_array_length(buf, self.partitions.len() as i32);
614 for el in &self.partitions {
615 write_i32(buf, *el);
616 }
617 let mut all_tags: Vec<RawTaggedField> = self._unknown_tagged_fields.clone();
618 all_tags.sort_by_key(|f| f.tag);
619 write_tagged_fields(buf, &all_tags)?;
620 Ok(())
621 }
622 pub fn encoded_len(&self, _version: i16) -> Result<usize> {
623 let mut len: usize = 0;
624 len += compact_string_len(&self.topic)?;
625 len += compact_array_length_len(self.partitions.len() as i32);
626 len += self.partitions.len() * 4usize;
627 let mut all_tags: Vec<RawTaggedField> = self._unknown_tagged_fields.clone();
628 all_tags.sort_by_key(|f| f.tag);
629 len += tagged_fields_len(&all_tags)?;
630 Ok(len)
631 }
632}
633#[derive(Debug, Clone, PartialEq)]
634pub struct TaskIds {
635 pub subtopology_id: KafkaString,
637 pub partitions: Vec<i32>,
639 pub _unknown_tagged_fields: Vec<RawTaggedField>,
640}
641impl Default for TaskIds {
642 fn default() -> Self {
643 Self {
644 subtopology_id: KafkaString::default(),
645 partitions: Vec::new(),
646 _unknown_tagged_fields: Vec::new(),
647 }
648 }
649}
650impl TaskIds {
651 pub fn with_subtopology_id(mut self, value: KafkaString) -> Self {
652 self.subtopology_id = value;
653 self
654 }
655 pub fn with_partitions(mut self, value: Vec<i32>) -> Self {
656 self.partitions = value;
657 self
658 }
659 pub fn read(buf: &mut Bytes, _version: i16) -> Result<Self> {
660 let subtopology_id;
661 let partitions;
662 let mut _unknown_tagged_fields: Vec<RawTaggedField> = Vec::new();
663 subtopology_id = read_compact_string(buf)?;
664 partitions = {
665 let len = read_compact_array_length(buf)?;
666 let mut arr = Vec::with_capacity(array_read_capacity(len, (buf).len()));
667 for _ in 0..len {
668 arr.push(read_i32(buf)?);
669 }
670 arr
671 };
672 let tagged_fields = read_tagged_fields(buf)?;
673 for field in &tagged_fields {
674 match field.tag {
675 _ => {
676 _unknown_tagged_fields.push(field.clone());
677 },
678 }
679 }
680 Ok(Self {
681 subtopology_id,
682 partitions,
683 _unknown_tagged_fields,
684 })
685 }
686 pub fn write(&self, buf: &mut BytesMut, _version: i16) -> Result<()> {
687 write_compact_string(buf, &self.subtopology_id)?;
688 write_compact_array_length(buf, self.partitions.len() as i32);
689 for el in &self.partitions {
690 write_i32(buf, *el);
691 }
692 let mut all_tags: Vec<RawTaggedField> = self._unknown_tagged_fields.clone();
693 all_tags.sort_by_key(|f| f.tag);
694 write_tagged_fields(buf, &all_tags)?;
695 Ok(())
696 }
697 pub fn encoded_len(&self, _version: i16) -> Result<usize> {
698 let mut len: usize = 0;
699 len += compact_string_len(&self.subtopology_id)?;
700 len += compact_array_length_len(self.partitions.len() as i32);
701 len += self.partitions.len() * 4usize;
702 let mut all_tags: Vec<RawTaggedField> = self._unknown_tagged_fields.clone();
703 all_tags.sort_by_key(|f| f.tag);
704 len += tagged_fields_len(&all_tags)?;
705 Ok(len)
706 }
707}
708#[derive(Debug, Clone, PartialEq)]
709pub struct Endpoint {
710 pub host: KafkaString,
712 pub port: u16,
714 pub _unknown_tagged_fields: Vec<RawTaggedField>,
715}
716impl Default for Endpoint {
717 fn default() -> Self {
718 Self {
719 host: KafkaString::default(),
720 port: 0_u16,
721 _unknown_tagged_fields: Vec::new(),
722 }
723 }
724}
725impl Endpoint {
726 pub fn with_host(mut self, value: KafkaString) -> Self {
727 self.host = value;
728 self
729 }
730 pub fn with_port(mut self, value: u16) -> Self {
731 self.port = value;
732 self
733 }
734 pub fn read(buf: &mut Bytes, _version: i16) -> Result<Self> {
735 let host;
736 let port;
737 let mut _unknown_tagged_fields: Vec<RawTaggedField> = Vec::new();
738 host = read_compact_string(buf)?;
739 port = read_u16(buf)?;
740 let tagged_fields = read_tagged_fields(buf)?;
741 for field in &tagged_fields {
742 match field.tag {
743 _ => {
744 _unknown_tagged_fields.push(field.clone());
745 },
746 }
747 }
748 Ok(Self {
749 host,
750 port,
751 _unknown_tagged_fields,
752 })
753 }
754 pub fn write(&self, buf: &mut BytesMut, _version: i16) -> Result<()> {
755 write_compact_string(buf, &self.host)?;
756 write_u16(buf, self.port);
757 let mut all_tags: Vec<RawTaggedField> = self._unknown_tagged_fields.clone();
758 all_tags.sort_by_key(|f| f.tag);
759 write_tagged_fields(buf, &all_tags)?;
760 Ok(())
761 }
762 pub fn encoded_len(&self, _version: i16) -> Result<usize> {
763 let mut len: usize = 0;
764 len += compact_string_len(&self.host)?;
765 len += 2;
766 let mut all_tags: Vec<RawTaggedField> = self._unknown_tagged_fields.clone();
767 all_tags.sort_by_key(|f| f.tag);
768 len += tagged_fields_len(&all_tags)?;
769 Ok(len)
770 }
771}