assert-struct v0.3.0
What's New
Set Pattern Support
New #(...) syntax for unordered collection matching. Each pattern in the set matches a distinct element, regardless of order.
// Exact set matching - collection must contain exactly these elements
assert_struct!(data, Data {
tags: #("rust", "async", "fast"),
..
});
// Partial set matching - find elements matching each pattern, ignore the rest
assert_struct!(data, Data {
scores: #(> 90, < 50, > 70, ..),
..
});
// Empty set matching
assert_struct!(data, Data {
items: #(),
..
});All existing patterns work within set patterns: comparisons, ranges, regex, nested structs, and more.
Bug Fixes
- Suppressed spurious
unreachable_patternswarnings for single-variant enums - Fixed a regression with index-based assertions on
Vecfields
Upgrading
[dev-dependencies]
assert-struct = "0.3"