Function zebra_consensus::transaction::check::check_for_duplicates

source ยท
fn check_for_duplicates<'t, T>(
    items: impl IntoIterator<Item = Cow<'t, T>>,
    error_wrapper: impl FnOnce(T) -> TransactionError,
) -> Result<(), TransactionError>
where T: Clone + Eq + Hash + 't,
Expand description

Check for duplicate items in a collection.

Each item should be wrapped by a Cow instance so that this helper function can properly handle borrowed items and owned items.

If a duplicate is found, an error created by the error_wrapper is returned.