5 releases
0.2.0 | Apr 8, 2025 |
---|---|
0.1.3 | Mar 25, 2025 |
0.1.2 | Mar 24, 2025 |
0.1.1 | Mar 24, 2025 |
0.1.0 | Mar 24, 2025 |
#502 in Testing
136 downloads per month
13KB
167 lines
An attribute macro that enforces per-version invariants on items.
use breaking_attr::breaking;
#[cfg_attr(test, test)]
fn hash_impl_did_not_change() {
#[breaking(sha2 = "zEk8F98i1LX-Rr070lCztGerzO1-qlLbosetY1UvSww=")]
const SEED: &str = "This value must not change between minor versions.";
#[breaking("cD1v24qkrBpNJl2awl4hTkYqrOHy3L3_IKMQSjN_LXo=")] // defaults to `blake3`
const HASH: u64 = 5201689092505688044;
// Just for example:
let mut hasher = std::hash::DefaultHasher::new();
hasher.write(SEED.as_bytes());
debug_assert_eq!(hasher.finish(), HASH);
}
See the documentation on breaking
An attribute macro to enforce per-version invariants on items.
use breaking_attr::breaking;
#[test]
fn hash_impl_did_not_change() {
#[breaking(sha2 = "zEk8F98i1LX-Rr070lCztGerzO1-qlLbosetY1UvSww=")]
const SEED: &str = "This value must not change between minor versions.";
#[breaking("3zIKlGMq-shMmThdYSOntWhl9QCx3A23i8tnEfNPWBY=")] // defaults to `blake3`
const HASH: u64 = 5201689092505688044;
// Just for example:
let mut hasher = std::hash::DefaultHasher::new();
hasher.write(SEED.as_bytes());
debug_assert_eq!(hasher.finish(), HASH);
}
Dependencies
~2–2.8MB
~68K SLoC