Attribute Macro breaking

Source
#[breaking]
Expand description

Marks an item that will break the public API if it is changed.

This works by comparing the hashed TokenStream of the item against a provided url-safe base64-encoded hash.

Changes to items marked with this attribute require updating the hash argument (which can be retrieved from the compile error generated by running it with a wrong hash) and most likely bumping the major version of the crate containing the item. At the very least, it should be explained in the commit message and any accompanying PR why the hash was updated without bumping the major version.

§Hashers

Multiple hash functions are supported via feature flags and one of the following function names provided as an argument to this macro, separated from the hash literal by an equal sign. Feel free to make a PR to add your preferred hash function.

§Example

use breaking_attr::breaking;

#[breaking(sha384 = "82y9Notlejn-Nfzl4SurR3m3Uqeaqt0jmN-wGHSAjNkHeywz1zYZeUJi-5-D0wo3")]
const SHA_384: &str = "This string must not change without updating the hash.";

#[breaking("IjrbZ-YsIRSb2v3ELtz-4zMqGvu5FVCkwotqCKMdhDE=")]
const DEFAULT: &str = "The default hasher is `blake3`";