Crates.io | hashfn |
lib.rs | hashfn |
version | 0.2.0 |
source | src |
created_at | 2022-05-12 07:10:10.769226 |
updated_at | 2022-05-16 07:32:08.109419 |
description | A procedural macro to generate a hash representation of a function as a string slice |
homepage | |
repository | https://github.com/johnnynotsolucky/hashfn |
max_upload_size | |
id | 585065 |
size | 19,828 |
A procedural macro to generate a hash representation of a function as a string slice.
The hash is generated as a const with the same visibility as the function the macro is applied to.
use hashfn::hashfn;
#[hashfn(DO_SOMETHING)]
pub(crate) fn do_something() {}
// Will expand to
// pub(crate) const DO_SOMETHING: &str = "<hash>";
// pub(crate) fn do_something() {}
hashfn
will generate the name of the constant if it is omitted:
use hashfn::hashfn;
#[hashfn]
pub(crate) fn do_something() {}
// Will expand to
// pub(crate) const DO_SOMETHING_HASH: &str = "<hash>";
// pub(crate) fn do_something() {}