hyperi-rustlib 2.8.6

There's plenty of sage advice out there about how to run Rust services in production at scale — config cascades, structured logging, masking secrets, multi-backend secrets management, Prometheus, OpenTelemetry, Kafka transports, tiered disk-spillover sinks, adaptive worker pools, graceful shutdown — but almost none of it as code you can just install and use. This is that code. Opinionated, drop-in, working out of the box. The patterns from blog posts, watercooler chats and beers with your Google mates as actual library — not a framework you assemble from twenty crates and 8 weeks of munging.
Documentation
// Project:   hyperi-rustlib
// File:      src/transport/kafka/token.rs
// Purpose:   Kafka transport commit token
// Language:  Rust
//
// License:   BUSL-1.1
// Copyright: (c) 2026 HYPERI PTY LIMITED

use crate::transport::traits::CommitToken;
use std::sync::Arc;

/// Commit token for Kafka transport.
///
/// Contains topic, partition, and offset for consumer group commits.
#[derive(Debug, Clone)]
pub struct KafkaToken {
    /// Topic name (shared Arc for efficiency).
    pub topic: Arc<str>,
    /// Partition number.
    pub partition: i32,
    /// Message offset.
    pub offset: i64,
}

impl KafkaToken {
    /// Create a new Kafka token.
    #[must_use]
    pub fn new(topic: Arc<str>, partition: i32, offset: i64) -> Self {
        Self {
            topic,
            partition,
            offset,
        }
    }
}

impl CommitToken for KafkaToken {}

impl std::fmt::Display for KafkaToken {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "kafka:{}:{}:{}", self.topic, self.partition, self.offset)
    }
}

impl PartialEq for KafkaToken {
    fn eq(&self, other: &Self) -> bool {
        self.topic == other.topic
            && self.partition == other.partition
            && self.offset == other.offset
    }
}

impl Eq for KafkaToken {}

impl std::hash::Hash for KafkaToken {
    fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
        self.topic.hash(state);
        self.partition.hash(state);
        self.offset.hash(state);
    }
}