pub fn find_duplicate_position<K>(
keys: impl IntoIterator<Item = K>,
) -> Option<(usize, usize)>Expand description
Detect duplicate keys in a batch input, loud-failing the whole request when found. Returns the first duplicate (by position) so the surfaced error can name a specific offending index. Linear- time, allocation-only in proportion to the input length.
Used by all five batch primitives — batch_get, batch_delete,
batch_update, batch_create (when the input carries a client-
supplied PK), and batch_upsert. The dedup posture is deliberate:
silently collapsing duplicates would break the per-item index
mapping the envelope promises and hide caller bugs.