kafka_client_engine/consumer/assigned_host/
assignment_capture.rs1use crate::clock::DeadlineCapture;
4
5use super::{
6 AssignedConsumerAssignment, AssignedConsumerHandle,
7 assignment_result::{
8 AssignedConsumerTryReplaceAssignmentAccepted, AssignedConsumerTryReplaceAssignmentError,
9 },
10};
11
12#[must_use = "dropping abandons the captured deadline without admitting assignment work"]
17pub struct AssignedConsumerAssignmentCapture<'handle> {
18 handle: &'handle mut AssignedConsumerHandle,
19 deadline: DeadlineCapture,
20}
21
22impl<'handle> AssignedConsumerAssignmentCapture<'handle> {
23 pub(super) const fn bind_deadline_to_handle(
24 handle: &'handle mut AssignedConsumerHandle,
25 deadline: DeadlineCapture,
26 ) -> Self {
27 Self { handle, deadline }
28 }
29
30 pub fn try_replace_assignment(
32 self,
33 entries: Vec<AssignedConsumerAssignment>,
34 ) -> Result<
35 AssignedConsumerTryReplaceAssignmentAccepted,
36 AssignedConsumerTryReplaceAssignmentError,
37 > {
38 self.handle
39 .try_replace_assignment_captured(entries, self.deadline)
40 }
41}
42
43impl std::fmt::Debug for AssignedConsumerAssignmentCapture<'_> {
44 fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
45 formatter
46 .debug_struct("AssignedConsumerAssignmentCapture")
47 .finish_non_exhaustive()
48 }
49}