Function insta::sorted_redaction

source ·
pub fn sorted_redaction() -> Redaction
Available on crate feature redactions only.
Expand description

Creates a dynamic redaction that sorts the value at the selector.

This is useful to force something like a set or map to be ordered to make it deterministic. This is necessary as insta’s serialization support is based on serde which does not have native set support. As a result vectors (which need to retain order) and sets (which should be given a stable order) look the same.

settings.add_redaction(".flags", sorted_redaction());