pub trait KafkaPartitioner: Send + Sync {
// Required methods
fn partition(
&mut self,
key: Option<&[u8]>,
num_partitions: i32,
) -> Option<i32>;
fn reset(&mut self);
}Expand description
Trait for determining the target Kafka partition for a record.
Implementations may be stateful (e.g., round-robin counter).
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".