kafka_client_engine/admin/describe_topic_partitions/outcome/
partition.rs1#[derive(Clone, Debug, Eq, PartialEq)]
5pub struct AdminDescribeTopicPartition {
6 pub(super) error_code: i16,
7 pub(super) partition_index: i32,
8 pub(super) leader_id: Option<i32>,
9 pub(super) leader_epoch: Option<i32>,
10 pub(super) replicas: Vec<i32>,
11 pub(super) isr: Vec<i32>,
12 pub(super) eligible_leader_replicas: Option<Vec<i32>>,
13 pub(super) last_known_elr: Option<Vec<i32>>,
14 pub(super) offline_replicas: Vec<i32>,
15}
16
17impl AdminDescribeTopicPartition {
18 pub const fn error_code(&self) -> i16 {
20 self.error_code
21 }
22
23 pub const fn partition_index(&self) -> i32 {
25 self.partition_index
26 }
27
28 pub const fn leader_id(&self) -> Option<i32> {
30 self.leader_id
31 }
32
33 pub const fn leader_epoch(&self) -> Option<i32> {
35 self.leader_epoch
36 }
37
38 pub fn replicas(&self) -> &[i32] {
40 &self.replicas
41 }
42
43 pub fn isr(&self) -> &[i32] {
45 &self.isr
46 }
47
48 pub fn eligible_leader_replicas(&self) -> Option<&[i32]> {
50 self.eligible_leader_replicas.as_deref()
51 }
52
53 pub fn last_known_elr(&self) -> Option<&[i32]> {
55 self.last_known_elr.as_deref()
56 }
57
58 pub fn offline_replicas(&self) -> &[i32] {
60 &self.offline_replicas
61 }
62
63 #[allow(clippy::type_complexity)]
65 pub fn into_parts(
66 self,
67 ) -> (
68 i16,
69 i32,
70 Option<i32>,
71 Option<i32>,
72 Vec<i32>,
73 Vec<i32>,
74 Option<Vec<i32>>,
75 Option<Vec<i32>>,
76 Vec<i32>,
77 ) {
78 (
79 self.error_code,
80 self.partition_index,
81 self.leader_id,
82 self.leader_epoch,
83 self.replicas,
84 self.isr,
85 self.eligible_leader_replicas,
86 self.last_known_elr,
87 self.offline_replicas,
88 )
89 }
90}