Skip to main content

kafka_client_engine/admin/describe_topic_partitions/outcome/
topic.rs

1//! Stable engine-owned topic facts for one explicit page.
2
3use super::AdminDescribeTopicPartition;
4
5/// One requested topic and its broker-provided partition subset.
6#[derive(Clone, Debug, Eq, PartialEq)]
7pub struct AdminDescribeTopicPartitionsTopic {
8    pub(super) error_code: i16,
9    pub(super) name: String,
10    pub(super) topic_id: [u8; 16],
11    pub(super) internal: bool,
12    pub(super) partitions: Vec<AdminDescribeTopicPartition>,
13    pub(super) authorized_operations: i32,
14}
15
16impl AdminDescribeTopicPartitionsTopic {
17    /// Returns Kafka's exact signed topic error.
18    pub const fn error_code(&self) -> i16 {
19        self.error_code
20    }
21
22    /// Returns the exact requested topic identity.
23    pub fn name(&self) -> &str {
24        &self.name
25    }
26
27    /// Returns all sixteen topic-ID bytes, including all-zero values.
28    pub const fn topic_id(&self) -> [u8; 16] {
29        self.topic_id
30    }
31
32    /// Reports Kafka's internal-topic flag.
33    pub const fn internal(&self) -> bool {
34        self.internal
35    }
36
37    /// Returns partitions in broker page order.
38    pub fn partitions(&self) -> &[AdminDescribeTopicPartition] {
39        &self.partitions
40    }
41
42    /// Returns Kafka's exact authorized-operations bitfield or sentinel.
43    pub const fn authorized_operations(&self) -> i32 {
44        self.authorized_operations
45    }
46
47    /// Consumes every exact topic fact into stable owned parts.
48    pub fn into_parts(
49        self,
50    ) -> (
51        i16,
52        String,
53        [u8; 16],
54        bool,
55        Vec<AdminDescribeTopicPartition>,
56        i32,
57    ) {
58        (
59            self.error_code,
60            self.name,
61            self.topic_id,
62            self.internal,
63            self.partitions,
64            self.authorized_operations,
65        )
66    }
67}