#breaking #blake3 #hasher

macro breaking-attr

An attribute macro that enforces per-version invariants on items

4 releases

new 0.1.3 Mar 25, 2025
0.1.2 Mar 24, 2025
0.1.1 Mar 24, 2025
0.1.0 Mar 24, 2025

#593 in Testing

Download history

99 downloads per month

MIT/Apache

11KB
97 lines

Crates.io Version docs.rs GitHub Actions Workflow Status

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);
}

lib.rs:

Crates.io Version docs.rs GitHub Actions Workflow Status

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

Dependencies

~1.9–2.8MB
~67K SLoC