split_by_discriminant 0.1.0

A small utility for partitioning a sequence of items by enum discriminant
Documentation

A small utility for partitioning a sequence of items by enum discriminant.

This crate helps partition a sequence of items by their enum discriminant. It is useful when you want to gather all values of a particular variant, operate on them, and then return them to the original collection.

The primary operation is [split_by_discriminant], which accepts any iterable producing values that borrow a type T (e.g. &T, &mut T, or even T itself, since Borrow<T> is blanket‑implemented for T). It returns a [SplitByDiscriminant] helper that exposes grouped references as well as any items that were not matched by the provided discriminants.

No traits beyond std::borrow::Borrow (used to obtain a &T for discriminant computation) are strictly required on the element type.