Skip to main content

Module unordered

Module unordered 

Source
Expand description

The bridge from a collection to the shape its membership diff takes.

#[delta_struct(field_type = "unordered")] says “diff this by membership and record nothing about order”, and two kinds of collection answer that in two different shapes. A set’s answer is a BagDelta: these elements came, these went. A map’s answer is an EntryDelta: a bare key is enough to say an entry left, because a map cannot hold the same key twice.

Unordered is what lets the derive write the right one down without knowing which it has. An unordered field’s delta is declared as <T as Unordered>::Delta, and the collection’s impl picks the shape.

Implement it for your own collection to make it eligible, delegating to bag, to entry, or to something of your own. A Vec deliberately has no impl — see the crate’s Limitations.

Traits§

Unordered
A collection that can be diffed by membership alone.