Crates.io | code-hasher |
lib.rs | code-hasher |
version | 0.1.0 |
source | src |
created_at | 2021-05-04 13:38:30.457709 |
updated_at | 2021-05-04 13:38:30.457709 |
description | Tiny macro which generates associated constants based on the associated item content |
homepage | |
repository | https://github.com/dusk-network/rusk |
max_upload_size | |
id | 393014 |
size | 24,193 |
Tiny proc macro library designed to hash a code block generating a unique
identifier for it which will get written into a const
inside of the code
block.
#[code_hasher::hash(SOME_CONST_NAME, version = "0.1.0")]
pub mod testing_module {
pub fn this_does_something() -> [u8; 32] {
SOME_CONST_NAME
}
}
Here, SOME_CONST_NAME
has assigned as value the resulting hash of:
The code contained inside testing_module
.
The version passed by the user (is optional). Not adding it will basically not hash this attribute and WILL NOT use any default alternatives.
This code is licensed under Mozilla Public License Version 2.0 (MPL-2.0). Please see LICENSE for further info.