Skip to main content

kafka_client_engine/admin/delete_share_group_offsets/
result.rs

1//! Stable ordered results for Admin `DeleteShareGroupOffsets`.
2
3/// Exact topic-level Kafka rejection with its bounded diagnostic.
4#[derive(Clone, Debug, Eq, PartialEq)]
5pub struct DeleteShareGroupOffsetsTopicError {
6    pub(super) code: i16,
7    pub(super) message: Option<String>,
8    pub(super) message_truncated: bool,
9}
10
11impl DeleteShareGroupOffsetsTopicError {
12    /// Returns Kafka's exact signed nonzero error code.
13    pub const fn code(&self) -> i16 {
14        self.code
15    }
16
17    /// Returns Kafka's optional bounded diagnostic.
18    pub fn message(&self) -> Option<&str> {
19        self.message.as_deref()
20    }
21
22    /// Reports whether the diagnostic was truncated at the retained-byte bound.
23    pub const fn message_truncated(&self) -> bool {
24        self.message_truncated
25    }
26
27    /// Consumes the rejection into exact stable parts.
28    pub fn into_parts(self) -> (i16, Option<String>, bool) {
29        (self.code, self.message, self.message_truncated)
30    }
31}
32
33/// One caller-ordered topic deletion result.
34#[derive(Clone, Debug, Eq, PartialEq)]
35pub struct DeleteShareGroupOffsetsTopicResult {
36    pub(super) topic: String,
37    pub(super) result: Result<[u8; 16], DeleteShareGroupOffsetsTopicError>,
38}
39
40impl DeleteShareGroupOffsetsTopicResult {
41    /// Returns the exact requested topic name.
42    pub fn topic(&self) -> &str {
43        &self.topic
44    }
45
46    /// Returns the exact topic ID or topic-local Kafka rejection.
47    pub const fn result(&self) -> &Result<[u8; 16], DeleteShareGroupOffsetsTopicError> {
48        &self.result
49    }
50
51    /// Consumes this result into stable identity and exact broker outcome.
52    pub fn into_parts(self) -> (String, Result<[u8; 16], DeleteShareGroupOffsetsTopicError>) {
53        (self.topic, self.result)
54    }
55}
56
57/// Ordered successful response plus Kafka's throttle observation.
58#[derive(Clone, Debug, Eq, PartialEq)]
59pub struct DeleteShareGroupOffsetsBatch {
60    pub(super) throttle_time_ms: u32,
61    pub(super) topics: Vec<DeleteShareGroupOffsetsTopicResult>,
62}
63
64impl DeleteShareGroupOffsetsBatch {
65    /// Returns Kafka's nonnegative throttle observation.
66    pub const fn throttle_time_ms(&self) -> u32 {
67        self.throttle_time_ms
68    }
69
70    /// Returns results in original caller topic order.
71    pub fn topics(&self) -> &[DeleteShareGroupOffsetsTopicResult] {
72        &self.topics
73    }
74
75    /// Consumes the batch into throttle and caller-ordered results.
76    pub fn into_parts(self) -> (u32, Vec<DeleteShareGroupOffsetsTopicResult>) {
77        (self.throttle_time_ms, self.topics)
78    }
79}